def minutiae_extract(path, results): plot = False # ratio = 0.2 # Extract names all_images = [] for f in os.listdir(path): all_images.append(os.path.join(path, f)) # Split train and test data # train_data, test_data = tl.split_train_test(all_images, ratio) print("\nAll_images size: {}\n".format(len(all_images))) all_times = [] for image in all_images: start = time.time() name = splitext(basename(image))[0] print(image) print("\nProcessing image '{}'".format(name)) cleaned_img = preprocess.blurrImage(image, name, plot) enhanced_img = img_e.image_enhance(cleaned_img, name, plot) print(type(enhanced_img)) cleaned_img = preprocess.cleanImage(enhanced_img, name, plot) skeleton = preprocess.thinImage(cleaned_img, name, plot) minExtract.process(skeleton, name, plot, results) all_times.append((time.time() - start)) mean, std = 0, 0 mean = np.mean(all_times) std = np.std(all_times) print("\n\nAlgorithm takes {:2.3f} (+/-{:2.3f}) seconds per image".format( mean, std))
def identify(self): top = tk.Toplevel(self) top.geometry('1000x700') # ============================================================================= # # ============================================================================= image_ext = '.jpg' plot = False path = None # ratio = 0.2 # Create folders for results # -r ../Data/Results/fingerprints # if args.get("results") is not None: # if not exists(args["results"]): # tl.makeDir(args["results"]) # path = args["results"] # Extract names # all_images = tl.natSort(tl.getSamples(args["path"], image_ext)) # all_images = tl.natSort(tl.getSamples('C:\\Users\\jagdi\\Desktop\\project\\MinutiaeFingerprint-master', image_ext)) all_images = tl.natSort( tl.getSamples('C:\\Program Files\\PIUF\\images_folder\\temp', image_ext)) # Split train and test data # train_data, test_data = tl.split_train_test(all_images, ratio) print("\nAll_images size: {}\n".format(len(all_images))) # all_times= [] print("all images\n", all_images) for image in all_images: # start = time.time() name = splitext(basename(image))[0] print("\nProcessing image '{}'".format(name)) self.pro = 'processing image' # print("path ={} ".format(args["path"])) print("image ={}".format(image)) img = cv2.imread(str(image), 0) equ = cv2.equalizeHist(img) cv2.imwrite('equalized\\' + str(name) + '.jpg', equ) all_eqimages = all_images = tl.natSort( tl.getSamples('equalized', image_ext)) for image in all_eqimages: name = splitext(basename(image))[0] print("\nProcessing image '{}'".format(name)) self.pro = 'processing' cleaned_img = preprocess.blurrImage(image, name, plot) enhanced_img = img_e.image_enhance(cleaned_img, name, plot) cleaned_img = preprocess.cleanImage(enhanced_img, name, plot) skeleton = preprocess.thinImage(cleaned_img, name, plot) revert = cv2.bitwise_not(skeleton) cv2.imwrite('thinned\\' + str(name) + '.jpg', revert) folder = 'equalized' for the_file in os.listdir(folder): file_path = os.path.join(folder, the_file) try: if os.path.isfile(file_path): os.unlink(file_path) except Exception as e: print(e) num_channel = 1 test_image = cv2.imread('thinned/temp.jpg') test_image = cv2.cvtColor(test_image, cv2.COLOR_BGR2GRAY) test_image = cv2.resize(test_image, (128, 128)) test_image = np.array(test_image) test_image = test_image.astype('float32') test_image /= 255 if num_channel == 1: if K.image_dim_ordering() == 'th': test_image = np.expand_dims(test_image, axis=0) test_image = np.expand_dims(test_image, axis=0) print(test_image.shape) else: test_image = np.expand_dims(test_image, axis=3) test_image = np.expand_dims(test_image, axis=0) print(test_image.shape) else: if K.image_dim_ordering() == 'th': test_image = np.rollaxis(test_image, 2, 0) test_image = np.expand_dims(test_image, axis=0) print(test_image.shape) else: test_image = np.expand_dims(test_image, axis=0) print(test_image.shape) loaded_model = load_model('model8.h5') result = int(loaded_model.predict_classes(test_image)) self.v.set(self.switch_demo(result)) b = tk.Button(top, text="OK", width=20, height=2, bg='brown', fg='white', command=lambda win=top: win.destroy()) b.pack(side="bottom") name1 = self.v.get() print(name1) label_2 = tk.Label(top, text="First Name", width=20, font=("bold", 10)) label_2.place(x=70, y=170) label_3 = tk.Label(top, text="Last Name", width=20, font=("bold", 10)) label_3.place(x=70, y=200) label_4 = tk.Label(top, text="Gender", width=20, font=("bold", 10)) label_4.place(x=70, y=230) label_5 = tk.Label(top, text="Email Address", width=20, font=("bold", 10)) label_5.place(x=70, y=260) label_6 = tk.Label(top, text="Contact No.", width=20, font=("bold", 10)) label_6.place(x=70, y=290) label_7 = tk.Label(top, text="Address", width=20, font=("bold", 10)) label_7.place(x=70, y=320) label_8 = tk.Label(top, text="Faculty", width=20, font=("bold", 10)) label_8.place(x=70, y=350) conn = sqlite3.connect('Form.db') with conn: cursor = conn.cursor() cursor.execute( 'SELECT First_Name FROM Student where First_Name="' + name1 + '"') rows = cursor.fetchall() label_2 = tk.Label(top, text=rows, width=20, font=("bold", 10)) label_2.place(x=240, y=170) cursor.execute('SELECT Last_Name FROM Student where First_Name="' + name1 + '"') rows1 = cursor.fetchall() label_3 = tk.Label(top, text=rows1, width=20, font=("bold", 10)) label_3.place(x=240, y=200) cursor.execute('SELECT Gender FROM Student where First_Name="' + name1 + '"') rows2 = cursor.fetchall() label_4 = tk.Label(top, text=rows2, width=20, font=("bold", 10)) label_4.place(x=240, y=230) cursor.execute('SELECT Email FROM Student where First_Name="' + name1 + '"') rows3 = cursor.fetchall() label_5 = tk.Label(top, text=rows3, width=20, font=("bold", 10)) label_5.place(x=240, y=260) cursor.execute( 'SELECT Contact_No FROM Student where First_Name="' + name1 + '"') rows4 = cursor.fetchall() label_6 = tk.Label(top, text=rows4, width=20, font=("bold", 10)) label_6.place(x=240, y=290) cursor.execute('SELECT Address FROM Student where First_Name="' + name1 + '"') rows5 = cursor.fetchall() label_7 = tk.Label(top, text=rows5, width=20, font=("bold", 10)) label_7.place(x=240, y=320) cursor.execute('SELECT Faculty FROM Student where First_Name="' + name1 + '"') rows6 = cursor.fetchall() label_8 = tk.Label(top, text=rows6, width=20, font=("bold", 10)) label_8.place(x=240, y=350) cursor.execute('SELECT Photo FROM Student where First_Name="' + name1 + '"') rows7 = cursor.fetchall() print(rows1) print(rows2) print(rows3) print(rows4) print(rows5) print(rows6) print(rows7) img = ImageLabel(top) img.pack(side="right") img.load(str(rows7[0][0]))
image_ext = '.tif' plot = False path = None # ratio = 0.2 # Create folders for results # -r ../Data/Results/fingerprints if args.get("results") is not None: if not exists(args["results"]): tl.makeDir(args["results"]) path = args["results"] # Extract names all_images = tl.natSort(tl.getSamples(args["path"], image_ext)) # Split train and test data # train_data, test_data = tl.split_train_test(all_images, ratio) print("\nAll_images size: {}\n".format(len(all_images))) all_times = [] for image in all_images: start = time.time() name = splitext(basename(image))[0] print("\nProcessing image '{}'".format(name)) cleaned_img = preprocess.blurrImage(image, name, plot) enhanced_img = img_e.image_enhance(cleaned_img, name, plot) cleaned_img = preprocess.cleanImage(enhanced_img, name, plot) # skeleton = preprocess.zhangSuen(cleaned_img, name, plot) skeleton = preprocess.thinImage(cleaned_img, name, plot) minExtract.process(skeleton, name, plot, path) all_times.append((time.time() - start)) mean = mean(all_times) std = std(all_times) print("\n\nAlgorithm takes {:2.3f} (+/-{:2.3f}) seconds per image".format( mean, std))