I've been advised to ask here, I hope that it fits.
I want to create a more straightforward and lighter version of this fantastic repo (which itself is based on Fingerprint Image Enhancement: Algorithm and Performance Evaluation).
The tradeoff here will be between the running time and the quality of the results, which will be damaged.
The idea is to iterate through some prefixed orientations, wavelengths, phases, and kernels and choose the most suiting one.
Here is my initial attempt:
def prepare_image_V1(img): orientations = [0, 45, 90, 135] wavelengths = [5, 7, 9, 11, 13, 15] phases = [0, np.pi/4, np.pi/2, 3*np.pi/4] kernels = [3, 5, 7, 9, 11] max_response = 0 for orientation in orientations: for wavelength in wavelengths: for phase in phases: for kernel_size in kernels: kernel = cv2.getGaborKernel( (kernel_size, kernel_size), 1.5, orientation, wavelength, 0.5, phase) response = cv2.filter2D(img, cv2.CV_64F, kernel) if np.sum(response) > np.sum(max_response): max_response = response max_response = max_response/np.amax(max_response)*255 return max_response
The problem with this is that it will choose the best orientation for the image as a whole.
E.g - The original image on the left, and on the right, the image after applying
prepare_image_V1 and some thresholding. We can see fairly good results where the orientation is 45 deg.
My question is how can I apply the filter for each region individually? I've tried to use
view_as_blocks and apply the same function to each block individually, but the results are just not good - I can "see" the blocks.
For comparison, here's the result of the above repo: