import glob
import cv2
import numpy as np
import os
fingerprint_test = cv2.imread("D:/mfapython/muhammadisthebest.tif")
cv2.imshow("Original", cv2.resize(fingerprint_test, None, fx=1, fy=1))
cv2.waitKey(0)
cv2.destroyAllWindows()
for file in [file for file in os. listdir("d:/mfapython/fingerprintdatabase/*.tif")]:
fingerprint_database_image = cv2.imread("./database/"+file)
fingerprint_database_image = [cv2.imread(file) for file in glob.glob("d:/mfapython/fingerprintdatabase/*.tif")]
sift = cv2.SIFT_create()
keypoints_1, descriptors_1 = sift.detectAndCompute(fingerprint_test, None)
keypoints_2, descriptors_2 = sift.detectAndCompute(fingerprint_database_image, None)
see error
cv2.error: OpenCV(4.8.1) D:\a\opencv-python\opencv-python\opencv\modules\features2d\src\sift.dispatch.cpp:512: error: (-5:Bad argument) image is empty or has incorrect depth (!=CV_8U) in function 'cv::SIFT_Impl::detectAn
computer
image is empty or has incorrect depth (!=CV_8U) in function 'cv::SIFT_Impl::detectAn
then, please, you MUST CHECK the outcome of imread() !
you MUST !!! ALWAYS !!!
if it does not load, you produce errors way down later in your code, and you dont know why …