Error While running the code
amanshah11 opened this issue · comments
gabor_filter = np.array(np.zeros((180 / angleInc, filt_rows, filt_cols)))
TypeError: 'float' object cannot be interpreted as an integer
While running the code with default values, this error shows up and prevents program to run further
I tried resolving it by using
gabor_filter = np.array(np.zeros((int(180/angleInc), (filt_rows), (filt_cols)), dtype = int))
but this shows another error
for o in range(0, 180 / angleInc):
TypeError: 'float' object cannot be interpreted as an integer
I looked for a solution online and found this
Replacing this part
for o in range(0,180/angleInc):`
rot_filt = scipy.ndimage.rotate(reffilter,-(o*angleInc + 90),reshape = False)
gabor_filter[o] = rot_filt
by this
angle_for_iter = (0,180/angleInc)
start_angle, last_angle = angle_for_iter
start_angle = int(start_angle)
last_angle = int(last_angle)
for o in range(start_angle, last_angle):
rot_filt = scipy.ndimage.rotate(reffilter,-(o*angleInc + 90),reshape = False)
gabor_filter[o] = rot_filt
after this is done we get an error in match
matches = sorted(bf.match(des1, des2), key=lambda match: match.distance)
cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\core\src\batch_distance.cpp:275: error: (-215:Assertion failed) type == src2.type() && src1.cols == src2.cols && (type == CV_32F || type == CV_8U) in function 'cv::batchDistance'
and i am stuck at this
Use Python2 for this version. I will update for python3 in future.
Pull the updated code.
The code is now running successfully on python 2.7.9