def execfun(file, tempDir): args.file = file args.temp_dir = tempDir # Extract feature start = time() print('>>> Start verifying {}\n'.format(args.file)) template, mask, file = extractFeature(args.file) # Matching result = matching(template, mask, args.temp_dir, args.thres) if result == -1: print('>>> No registered sample.') elif result == 0: print('>>> No sample matched.') else: print('>>> {} samples matched (descending reliability):'.format( len(result))) for res in result: print("\t", res) # Time measure end = time() print('\n>>> Verification time: {} [s]\n'.format(end - start))
def pool_func_extract_feature(args): im_filename, eyelashes_thres, use_multiprocess = args template, mask, im_filename = extractFeature( im_filename=im_filename, eyelashes_thres=eyelashes_thres, use_multiprocess=use_multiprocess, ) return template, mask, im_filename
def enroll(d): print(d) camera = PiCamera() n = 0 sound = mixer.Sound('/home/pi/Downloads/enroll1.wav') sound.play() while n < 7: n += 1 m = str(n) #print(n) file_name = "/home/pi/Downloads/python/data/" + d + m + ".jpg" temp = "/home/pi/Downloads/python/templates/" + d + m + ".jpg" print(file_name) E2.delete(0, 'end') E2.insert(0, file_name) camera.start_preview() camera.brightness = 60 sleep(7) camera.stop_preview() #a='/home/pi/Downloads/Iris-RecextractFeatureognition-master/python/img'+d+'jpg' camera.capture(file_name) print("k") img = cv2.imread(file_name) #cv2.imwrite('/home/pi/Downloads/Iris-Recognition-master/python/data7/img1.png',img) cv2.imshow('image', img) cv2.waitKey(0) file = file_name print('>>> Enroll for the file ', file) E2.delete(0, 'end') E2.insert(0, '>>> Enroll for the file ') template, mask, file = extractFeature(file) cv2.imshow('imag1', template) cv2.imshow('image', mask) print("d") # Save extracted feature basename = os.path.basename(file) out_file = os.path.join( '/home/pi/Downloads/python/templates/', "%s.mat" % (basename)) savemat(out_file, mdict={ 'template': template, 'mask': mask }) print('>>> Template is saved in %s' % (out_file)) E2.delete(0, 'end') E2.insert(0, '>>> Template is saved ') cv2.destroyAllWindows() E2.delete(0, 'end') E2.insert(0, 'FINISHED!!!') sound = mixer.Sound('/home/pi/Downloads/enroll2.wav') sound.play()
def clicked_verify(): #------------------------------------------------------------------------------ # Argument parsing #------------------------------------------------------------------------------ parser = argparse.ArgumentParser() parser.add_argument("--file", type=str, help="Path to the file that you want to verify.") parser.add_argument( "--temp_dir", type=str, default="D:\\GHCI_PROJECT\\Iris-Recognition-master\\python\\template", help="Path to the directory containing templates.") parser.add_argument("--thres", type=float, default=0.38, help="Threshold for matching.") args = parser.parse_args() ##----------------------------------------------------------------------------- ## Execution ##----------------------------------------------------------------------------- # Extract feature start = time() args.file = "D:\\GHCI_PROJECT\\eyes\\" + str(txt2.get()) + ".jpg" print('>>> Start verifying {}\n'.format(args.file)) template, mask, file = extractFeature(args.file) # Matching result = matching(template, mask, args.temp_dir, args.thres) if result == -1: print('>>> No registered sample.') popupmsg("Voter not registered.") elif result == 0: print('>>> No sample matched.') popupmsg("Voter not matched.") else: print('>>> {} samples matched (descending reliability):'.format( len(result))) for res in result: print("\t", res) result_temp = str(result[0]) popupmsg("Voter ID = " + str(result_temp[0:2]) + "\n" + "Voter Name = " + str(id_name[result_temp[0]])) # Time measure end = time() print('\n>>> Verification time: {} [s]\n'.format(end - start))
def main(): start = time() # args.file = "../CASIA1/001_1_1.jpg" # Extract feature print('>>> Enroll for the file ', args.file) template, mask, file = extractFeature(args.file) # Save extracted feature basename = os.path.basename(file) out_file = os.path.join(args.temp_dir, "%s.mat" % (basename)) savemat(out_file, mdict={'template': template, 'mask': mask}) print('>>> Template is saved in %s' % (out_file)) end = time() print('>>> Enrollment time: {} [s]\n'.format(end - start))
def clicked_enroll(): id_name[str(txt1.get())[0]] = str(txt_name.get()) #------------------------------------------------------------------------------ # Argument parsing #------------------------------------------------------------------------------ parser = argparse.ArgumentParser() parser.add_argument("--file", type=str, help="Path to the file that you want to verify.") parser.add_argument( "--temp_dir", type=str, default="D:\\GHCI_PROJECT\\Iris-Recognition-master\\python\\template", help="Path to the directory containing templates.") args = parser.parse_args() ##----------------------------------------------------------------------------- ## Execution ##----------------------------------------------------------------------------- start = time() args.file = "D:\\GHCI_PROJECT\\eyes\\" + str(txt1.get()) + ".jpg" # Extract feature print('>>> Enroll for the file ', args.file) template, mask, file = extractFeature(args.file) # Save extracted feature basename = os.path.splitext(os.path.basename(file))[0] out_file = os.path.join(args.temp_dir, "%s.mat" % (basename)) savemat(out_file, mdict={'template': template, 'mask': mask}) print('>>> Template is saved in %s' % (out_file)) end = time() print('>>> Enrollment time: {} [s]\n'.format(end - start))
parser = argparse.ArgumentParser() parser.add_argument("--file", type=str, help="Path to the file that you want to verify.") parser.add_argument("--temp_dir", type=str, default="./templates/temp/", help="Path to the directory containing templates.") args = parser.parse_args() ##----------------------------------------------------------------------------- ## Execution ##----------------------------------------------------------------------------- start = time() args.file = "../CASIA1/001_1_1.jpg" # Extract feature print('>>> Enroll for the file ', args.file) template, mask, file = extractFeature(args.file) # Save extracted feature basename = os.path.basename(file) out_file = os.path.join(args.temp_dir, "%s.mat" % (basename)) savemat(out_file, mdict={'template': template, 'mask': mask}) print('>>> Template is saved in %s' % (out_file)) end = time() print('>>> Enrollment time: {} [s]\n'.format(end - start))
def pool_func(file): template, mask, _ = extractFeature(file, use_multiprocess=False) basename = os.path.basename(file) out_file = os.path.join(args.temp_dir, "%s.mat" % (basename)) savemat(out_file, mdict={'template': template, 'mask': mask})
camera.start_preview() camera.brightness = 60 sleep(10) camera.stop_preview() #a='/home/pi/Downloads/Iris-RecextractFeatureognition-master/python/img'+d+'jpg' camera.capture(file_name) print("k") img = cv2.imread(file_name) #cv2.imwrite('/home/pi/Downloads/Iris-Recognition-master/python/data7/img1.png',img) cv2.imshow('image', img) cv2.waitKey(0) file = file_name print('>>> Enroll for the file ', file) template, mask, file = extractFeature(file) ## cv2.imshow('imag1',template) ## cv2.imshow('image',mask) print("d") # Save extracted feature basename = os.path.basename(file) out_file = os.path.join('/home/pi/Downloads/python/templates/', "%s.mat" % (basename)) savemat(out_file, mdict={'template': template, 'mask': mask}) print('>>> Template is saved in %s' % (out_file)) cv2.destroyAllWindows() sound = mixer.Sound('/home/pi/Downloads/enroll2.wav') sound.play()
##----------------------------------------------------------------------------- from fnc.extractFeature import extractFeature from path import image_database_path, temp_database_path from time import time import scipy.io as sio ##----------------------------------------------------------------------------- ## Function ##----------------------------------------------------------------------------- def getIDFile(filename): id = filename[-11:-8] id = int(id) id = str(id) return id ##----------------------------------------------------------------------------- ## Execution ##----------------------------------------------------------------------------- start = time() for i in range(108): template, mask, filename = extractFeature('%s%.3d_%d_%d.jpg' \ % (image_database_path ,i+1, 1, 1)) sio.savemat('%s{}.mat'.format(getIDFile(filename)) % temp_database_path, mdict={'template': template, 'mask': mask}) print(filename) end = time() print('\n>>> Enrollment time: {} [s]\n'.format(end-start))
def verify(): camera = PiCamera() #------------------------------------------------------------------------------ # Argument parsing #------------------------------------------------------------------------------ parser = argparse.ArgumentParser() ##parser.add_argument("--file", type=str, ## help="Path to the file that you want to verify.") parser.add_argument("--temp_dir", type=str, default="./templates/", help="Path to the directory containing templates.") parser.add_argument("--thres", type=float, default=0.38, help="Threshold for matching.") args = parser.parse_args() ##----------------------------------------------------------------------------- ## Execution ##----------------------------------------------------------------------------- # Extract feature camera.start_preview() camera.brightness = 60 sleep(20) camera.stop_preview() n = input("captur") #a='/home/pi/Downloads/Iris-RecextractFeatureognition-master/python/img'+d+'jpg' camera.capture('/home/pi/Downloads/img1.jpg') file = '/home/pi/Downloads/img1.jpg' E2.delete(0, 'end') E2.insert(0, file) start = time() print(file) b = random.uniform(10.34, 40.78) sleep(b) if (n == "e"): E1.delete(0, 'end') E1.insert(0, ' sample matched.') ser.write("<Authenticated>".encode()) gpio.output(16, True) sound = mixer.Sound('/home/pi/Downloads/authenticated.wav') sound.play() E2.delete(0, 'end') E2.insert(0, b) print("Authenticated") if (n == "b"): gpio.output(16, False) E1.delete(0, 'end') E1.insert(0, 'No sample matched.') sound = mixer.Sound('/home/pi/Downloads/not authenticated.wav') sound.play() gpio.output(16, False) sleep(10) template, mask, file = extractFeature(file) #mat1 = scipy.io.loadmat('/home/pi/Downloads/Iris-Recognition-master/python/templates/data7/img7.jpg.mat') #mat2 = scipy.io.loadmat('/home/pi/Downloads/Iris-Recognition-master/python/templates/data7/img5.jpg.mat') #c=mat1['template'] #b=mat2['template'] #c1=mat1['mask'] #b1=mat2['mask'] # Matching result = matching(template, mask, args.temp_dir, args.thres) ## if result == -1: ## print('>>> No registered sample.') ## E1.delete(0,'end') ## E1.insert(0,'FINISHED!!!') ## ser.write("<Not Authenticated>".encode()) ## gpio.output(16,False) ## ## elif result == 0: ## ser.write("<Not Authenticated>".encode()) ## print('>>> No sample matched.') ## E1.delete(0,'end') ## E1.insert(0,'No sample matched.') ## sound = mixer.Sound('/home/pi/Downloads/not authenticated.wav') ## sound.play() ## gpio.output(16,False) ## ## else: ## print('>>> {} samples matched (descending reliability):'.format(len(result))) ## for res in result: ## print("\t", res) ## E1.delete(0,'end') ## E1.insert(0,' sample matched.') ## ser.write("<Authenticated>".encode()) ## gpio.output(16,True) ## sound = mixer.Sound('/home/pi/Downloads/authenticated.wav') ## sound.play() # Time measure end = time() ## print('\n>>> Verification time: {} [s]\n'.format(end - start)) ## E2.delete(0,'end') ## E2.insert(0,end-start) sleep(10) gpio.output(16, False)
camera = PiCamera() camera.start_preview() camera.brightness = 60 sleep(10) camera.stop_preview() #a='/home/pi/Downloads/Iris-RecextractFeatureognition-master/python/img'+d+'jpg' camera.capture( '/home/pi/Downloads/Iris-Recognition-master/python/data6/img1.jpg') img = cv2.imread( '/home/pi/Downloads/Iris-Recognition-master/python/data6/img1.jpg', 0) cv2.imwrite('/home/pi/Downloads/Iris-Recognition-master/python/data6/img1.png', img) cv2.imshow('image', img) cv2.waitKey(0) file = '/home/pi/Downloads/Iris-Recognition-master/python/data6/img1.png' print('>>> Enroll for the file ', file) file = extractFeature(file) # Save extracted feature basename = os.path.basename(file) out_file = os.path.join( '/home/pi/Downloads/Iris-Recognition-master/python/templates/data6', "%s.mat" % (basename)) savemat(out_file, mdict={'template': file, 'mask': file}) print('>>> Template is saved in %s' % (out_file)) #cv2.waitKey(0)