updated template extraction

This commit is contained in:
Tom Selier 2023-09-28 17:22:21 +02:00
parent 0738cb6a52
commit ae3ee599e8

View File

@ -92,13 +92,16 @@ detector_params.adaptiveThreshWinSizeMax = 150 # Takes longer, but better chance
dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_ARUCO_ORIGINAL) dictionary = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_ARUCO_ORIGINAL)
detector = cv2.aruco.ArucoDetector(dictionary, detector_params) detector = cv2.aruco.ArucoDetector(dictionary, detector_params)
images_converted = 0
images_skipped = 0
### IMAGE CONVERSIE ### ### IMAGE CONVERSIE ###
for folder in os.listdir(input_directory): for folder in os.listdir(input_directory):
if folder.endswith('.py'): if folder.endswith('.py'):
print("Skipping", folder) print("Skipping", folder)
continue continue
if folder.endswith('.jpg'): if folder.lower().endswith('.jpg'):
continue continue
if SAVE: if SAVE:
@ -147,10 +150,12 @@ for folder in os.listdir(input_directory):
if ids is None: if ids is None:
print("Skipping: ", filename) print("Skipping: ", filename)
print("=============================================") print("=============================================")
images_skipped += 1
continue continue
if len(ids) != 4: if len(ids) != 4:
print("Skipping: ", filename) print("Skipping: ", filename)
print("=============================================") print("=============================================")
images_skipped += 1
continue continue
if VERBOSE: if VERBOSE:
@ -246,5 +251,10 @@ for folder in os.listdir(input_directory):
cv2.waitKey(0) cv2.waitKey(0)
if VERBOSE: if VERBOSE:
print("=============================================") print("=============================================")
images_converted += 1
if VERBOSE:
print("%d van de %d succesvol"
%(images_converted, (images_converted+images_skipped)))
cv2.destroyAllWindows() cv2.destroyAllWindows()