added skipped names

This commit is contained in:
Tom Selier 2023-10-20 16:11:02 +02:00
parent 8850f957ae
commit bfe4a09f8d

View File

@ -94,6 +94,7 @@ detector = cv2.aruco.ArucoDetector(dictionary, detector_params)
images_converted = 0 images_converted = 0
images_skipped = 0 images_skipped = 0
names_skipped = []
### IMAGE CONVERSIE ### ### IMAGE CONVERSIE ###
for folder in os.listdir(input_directory): for folder in os.listdir(input_directory):
@ -147,16 +148,12 @@ for folder in os.listdir(input_directory):
if VERBOSE: if VERBOSE:
print("IDs detected:\n", ids) print("IDs detected:\n", ids)
if ids is None: if ids is None or len(ids) != 4:
print("Skipping: ", filename) print("Skipping: ", filename)
print("=============================================") print("=============================================")
names_skipped.append(filename)
images_skipped += 1 images_skipped += 1
continue continue
if len(ids) != 4:
print("Skipping: ", filename)
print("=============================================")
images_skipped += 1
continue
if VERBOSE: if VERBOSE:
print("%d markers gedetecteerd" %len(ids)) print("%d markers gedetecteerd" %len(ids))
@ -256,5 +253,12 @@ for folder in os.listdir(input_directory):
if VERBOSE: if VERBOSE:
print("%d van de %d succesvol" print("%d van de %d succesvol"
%(images_converted, (images_converted+images_skipped))) %(images_converted, (images_converted+images_skipped)))
if images_skipped != 0:
print("")
with open(os.path.join(input_directory, "skipped.txt"), 'w') as file:
for name in names_skipped:
file.write(name)
file.write("\n")
cv2.destroyAllWindows() cv2.destroyAllWindows()