Merge pull request #49 from ANaaim/Full_change_image_for_pointing

Full change of the image if pointing necessary
This commit is contained in:
David PAGNON 2023-11-12 09:25:01 +01:00 committed by GitHub
commit 28108493f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -817,7 +817,8 @@ def imgp_objp_visualizer_clicker(img, imgp=[], objp=[], img_path=''):
- imgp_confirmed: image points that have been correctly identified. array of [[2d corner coordinates]] - imgp_confirmed: image points that have been correctly identified. array of [[2d corner coordinates]]
- only if objp!=[]: objp_confirmed: array of [3d corner coordinates] - only if objp!=[]: objp_confirmed: array of [3d corner coordinates]
''' '''
global old_image_path
old_image_path = img_path
def on_key(event): def on_key(event):
''' '''
@ -856,6 +857,16 @@ def imgp_objp_visualizer_clicker(img, imgp=[], objp=[], img_path=''):
if event.key == 'c': if event.key == 'c':
# TODO: RIGHT NOW, IF 'C' IS PRESSED ANOTHER TIME, OBJP_CONFIRMED AND IMGP_CONFIRMED ARE RESET TO [] # TODO: RIGHT NOW, IF 'C' IS PRESSED ANOTHER TIME, OBJP_CONFIRMED AND IMGP_CONFIRMED ARE RESET TO []
# We should reopen a figure without point on it
img_for_pointing = cv2.imread(old_image_path)
if img_for_pointing is None:
cap = cv2.VideoCapture(old_image_path)
ret, img_for_pointing = cap.read()
img_for_pointing = cv2.cvtColor(img_for_pointing, cv2.COLOR_BGR2RGB)
ax.imshow(img_for_pointing)
# To update the image
plt.draw()
if 'objp_confirmed' in globals(): if 'objp_confirmed' in globals():
del objp_confirmed del objp_confirmed
# If 'c', allows retrieving imgp_confirmed by clicking them on the image # If 'c', allows retrieving imgp_confirmed by clicking them on the image