def __init__(self, patch_types=None, des_model_dirs=None, minu_model_dir=None): self.des_models = None self.patch_types = patch_types self.minu_model = None self.minu_model_dir = minu_model_dir self.des_model_dirs = des_model_dirs if self.minu_model_dir is not None: self.minu_model = (minutiae_AEC.ImportGraph(minu_model_dir)) self.dict, self.spacing, self.dict_all, self.dict_ori, self.dict_spacing = get_maps.construct_dictionary( ori_num=24) patchSize = 160 oriNum = 64 self.patchIndexV = descriptor.get_patch_index(patchSize, patchSize, oriNum, isMinu=1) if self.des_model_dirs is not None: self.des_models = [] for model_dir in self.des_model_dirs: self.des_models.append(descriptor.ImportGraph(model_dir)) self.patch_size = 96 # self.minu_models = [] # for model_dir in self.des_model_dirs: # self.minu_models.append(descriptor.ImportGraph(model_dir)) self.gabor_filters = filtering.get_gabor_filters()
def __init__(self, patch_types=None, des_model_dirs=None, minu_model_dir=None): self.des_models = None self.patch_types = patch_types self.minu_model = None self.minu_model_dir = minu_model_dir self.des_model_dirs = des_model_dirs if self.minu_model_dir is not None: self.minu_model = (minutiae_AEC.ImportGraph(minu_model_dir)) self.dict, self.spacing, self.dict_all, self.dict_ori, self.dict_spacing = get_maps.construct_dictionary( ori_num=24) patchSize = 160 oriNum = 64 if des_model_dirs is not None and len(des_model_dirs) > 0: self.patchIndexV = descriptor.get_patch_index(patchSize, patchSize, oriNum, isMinu=1) if self.des_model_dirs is not None: self.des_models = [] for model_dir in self.des_model_dirs: self.des_models.append( descriptor.ImportGraph(model_dir, input_name="inputs:0", output_name='embedding:0')) self.patch_size = 96
def __init__(self,patch_types=None,des_model_dirs=None,minu_model_dir=None, enhancement_model_dir = None, ROI_model_dir=None): self.des_models = None self.patch_types = patch_types self.minu_model = None self.minu_model_dir = minu_model_dir self.des_model_dirs = des_model_dirs self.enhancement_model_dir = enhancement_model_dir self.ROI_model_dir = ROI_model_dir self.dict, self.spacing, self.dict_all, self.dict_ori, self.dict_spacing = get_maps.construct_dictionary(ori_num=60) if self.minu_model_dir is not None: self.minu_model = (minutiae_AEC.ImportGraph(minu_model_dir)) patchSize = 160 oriNum = 64 self.patchIndexV = descriptor.get_patch_index(patchSize, patchSize, oriNum, isMinu=1) if self.des_model_dirs is not None: self.des_models = [] for model_dir in self.des_model_dirs: self.des_models.append(descriptor.ImportGraph(des_model_dirs)) if self.enhancement_model_dir is not None: self.enhancement_model = enhancement_AEC.ImportGraph(enhancement_model_dir) if self.ROI_model_dir is not None: self.ROI_model = (RCNN.ImportGraph(ROI_model_dir))
def __init__(self, patch_types=None, des_model_dirs=None, minu_model_dir=None): self.des_models = None self.patch_types = patch_types self.minu_model = None self.minu_model_dir = minu_model_dir self.des_model_dirs = des_model_dirs print("Loading models, this may take some time...") if self.minu_model_dir is not None: print("Loading minutiae model: " + minu_model_dir) self.minu_model = (minutiae_AEC.ImportGraph(minu_model_dir)) self.dict, self.spacing, self.dict_all, self.dict_ori, self.dict_spacing = get_maps.construct_dictionary( ori_num=24) patchSize = 160 oriNum = 64 if des_model_dirs is not None and len(des_model_dirs) > 0: self.patchIndexV = descriptor.get_patch_index(patchSize, patchSize, oriNum, isMinu=1) if self.des_model_dirs is not None: self.des_models = [] for i, model_dir in enumerate(des_model_dirs): print("Loading descriptor model (" + str(i + 1) + " of " + str(len(des_model_dirs)) + "): " + model_dir) self.des_models.append( descriptor.ImportGraph(model_dir, input_name="inputs:0", output_name='embedding:0')) self.patch_size = 96
def __init__(self, patch_types=None, des_model_dirs=None, minu_model_dirs=None, enhancement_model_dir=None, ROI_model_dir=None, coarsenet_dir=None, FineNet_dir=None): self.des_models = None self.patch_types = patch_types self.minu_model = None self.minu_model_dirs = minu_model_dirs self.des_model_dirs = des_model_dirs self.enhancement_model_dir = enhancement_model_dir self.ROI_model_dir = ROI_model_dir self.dict, self.spacing, self.dict_all, self.dict_ori, self.dict_spacing = get_maps.construct_dictionary( ori_num=60) print("Loading models, this may take some time...") if self.minu_model_dirs is not None: self.minu_model = [] for i, minu_model_dir in enumerate(minu_model_dirs): print("Loading minutiae model (" + str(i + 1) + " of " + str(len(minu_model_dirs)) + "): " + minu_model_dir) self.minu_model.append( minutiae_AEC.ImportGraph(minu_model_dir)) self.coarsenet_dir = coarsenet_dir patchSize = 160 oriNum = 64 self.patchIndexV = descriptor.get_patch_index(patchSize, patchSize, oriNum, isMinu=1) if self.des_model_dirs is not None: self.des_models = [] for i, model_dir in enumerate(des_model_dirs): print("Loading descriptor model (" + str(i + 1) + " of " + str(len(des_model_dirs)) + "): " + model_dir) self.des_models.append( descriptor.ImportGraph(model_dir, input_name="inputs:0", output_name='embedding:0')) if self.enhancement_model_dir is not None: print("Loading enhancement model: " + self.enhancement_model_dir) self.enhancement_model = enhancement_AEC.ImportGraph( enhancement_model_dir) print("Finished loading models.")
def demo_minutiae_extraction(img_path,minu_model_dir): img_files = glob.glob(img_path+'*.bmp') img_files.sort() minu_model = (minutiae_AEC.ImportGraph(minu_model_dir)) block = True for i, img_file in enumerate(img_files): if i<11: continue img = io.imread(img_file) name = os.path.basename(img_file) h, w = img.shape mask = np.ones((h,w),dtype=np.uint8) minu_thr = 0.3 texture_img = preprocessing.FastCartoonTexture(img) contrast_img = preprocessing.local_constrast_enhancement_gaussian(img) dir_map, fre_map = get_maps.get_maps_STFT(contrast_img, patch_size=64, block_size=16, preprocess=True) dict, spacing,_ = get_maps.construct_dictionary(ori_num=60) quality_map, fre_map = get_maps.get_quality_map_ori_dict(contrast_img, dict, spacing, dir_map=dir_map, block_size=16) enh_texture_img = filtering.gabor_filtering_pixel(contrast_img, dir_map + math.pi / 2, fre_map, mask=mask, block_size=16, angle_inc=3) mnt = minu_model.run(contrast_img, minu_thr=0.1) #mnt = minu_model.remove_spurious_minutiae(mnt, mask) #minutiae_sets.append(mnt) #fname = output_path + os.path.splitext(name)[0] + '_texture_img.jpeg' show.show_minutiae(contrast_img, mnt, block=block, fname=None) mnt = minu_model.run(texture_img, minu_thr=0.1) # mnt = minu_model.remove_spurious_minutiae(mnt, mask) # minutiae_sets.append(mnt) # fname = output_path + os.path.splitext(name)[0] + '_texture_img.jpeg' show.show_minutiae(texture_img, mnt, block=block, fname=None) print(i)
ax0.imshow(image, cmap='gray') ax0.set_title('original image') ax0.axis('off') ax0.set_adjustable('box-forced') ax1.imshow(dilated, vmin=image.min(), vmax=image.max(), cmap='gray') ax1.set_title('dilated') ax1.axis('off') ax1.set_adjustable('box-forced') ax2.imshow(image - dilated, cmap='gray') ax2.set_title('image - dilated') ax2.axis('off') ax2.set_adjustable('box-forced') fig.tight_layout() plt.show() if __name__ == '__main__': # construct ridge structure dictionary for quality estimation or ridge spacing estimation dict = get_maps.construct_dictionary() imgfiles = glob.glob('/home/kaicao/Dropbox/Research/Data/Latent/NISTSD27/image/*.bmp') imgfiles.sort() for imgfile in imgfiles: img = cv2.imread(imgfile, cv2.IMREAD_GRAYSCALE) img = np.asarray(img, np.float32) texture = FastCartoonTexture(img) dir_map, _, _ = get_maps.get_maps_STFT(texture, patch_size=64, block_size=16, preprocess=False)