strokeFilter function giving error
RajaParikshit opened this issue · comments
In StrokeFilter.py file function def strokeFilter(im, orient, freq, kx, ky):
is giving error on following line
sigmax = 1 / unfreq[0] * kx
sigmay = 1 / unfreq[0] * ky
Error Stack -
File "D:\OCR\signature_extractor-master\signature_verifier\verifier\__init__.py", line 12, in verify
kp1, des1 = extractKeypoints(img1)
File "D:\OCR\signature_extractor-master\signature_verifier\verifier\ExtractKeypoints.py", line 42, in extractKeypoints
img = preprocessing(img)
File "D:\OCR\signature_extractor-master\signature_verifier\verifier\Preprocessing.py", line 26, in preprocessing
newim = strokeFilter(normim, orientim, freq, kx, ky)
File "D:\OCR\signature_extractor-master\signature_verifier\verifier\StrokeFilter.py", line 21, in strokeFilter
sigmax = 1 / unfreq[0] * kx
IndexError: index 0 is out of bounds for axis 0 with size 0
I think in your input non_zero_elems_in_freq is empty.
This happens with few images. I'm really not getting any solution for this. What is reason that non_zero_elems_in_freq
is getting empty input. Below is code
angleInc = 3
im = np.double(im)
rows, cols = im.shape
newim = np.zeros((rows, cols))
freq_1d = np.reshape(freq, (1, rows * cols))
ind = np.where(freq_1d > 0)
ind = np.array(ind)
ind = ind[1, :]
non_zero_elems_in_freq = freq_1d[0][ind]
Images that doesn't throw any error are following :
My question is , is it necessary for signature to be all connected ? Means if there is one signature that has more than one separate part, it is failing.
Hii do you get this problem? I'm really stuck due to this.
Hi, @RajaParikshit sorry for the late reply. Increase the block size for covering chunk wise signature. That will resolve the issue.
Can you show me in code ?