I’m using gabor filter on ROI (region of interest) images then i’m putting them on the CNN model is this code right for CNN and palmprint recognition ?
# Define Gabor filters
def build_filters():
filters = []
ksize = 11
for theta in range(4):
theta = np.pi * (theta / 4)
for sigma in (1, 3, 5, 7, 9) :
for lambd in np.arange(0, np.pi, np.pi / 4):
for gamma in (0.05, 0.3):
kern = cv2.getGaborKernel((ksize, ksize), sigma, theta, lambd, gamma, 0.4, ktype=cv2.CV_32F)
kern /= 1.5 * kern.sum()
filters.append(kern)
return filters
# Apply Gabor filters to the image
def process(img, filters):
accum = np.zeros_like(img)
for kern in filters:
fimg = cv2.filter2D(img, cv2.CV_8UC3, kern)
np.maximum(accum, fimg, accum)
return accum
I’m putting the result returned from process method on the CNN model