I'm trying to implement an "LOG blob detector" using python and openCV.
the idea is to create 10-15 levels of LOG filters, apply each of them to my original gray scale image and save the images in an array of size height x width x numOfLevels and then find the local maximums on the 3D array.
The problem is I'm not sure how to save these in an array.
I tried to do the following:
myImage = cv2.imread('butterfly.jpg')
gray_image = cv2.cvtColor(myImage, cv2.COLOR_BGR2GRAY)
sigma = 2
k = 2**(0.25)
std2 = float(sigma**2)
arr = []
for i in range(10):
filt_size = 2*np.ceil(3*sigma)+1
H = log_filt( filt_size, sigma)
H *= sigma**2
dst = cv2.filter2D(gray_image,-1,H)
arr.append(dst)
cv2.imshow('Gray', dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
sigma = sigma * k
std2 = float(sigma**2)
plt.imshow(H,interpolation='nearest')
But then if I try to take on the of the images and use cv2.imshow(arr[0]) I get the following error:
TypeError: Required argument 'mat' (pos 2) not found
What am I doing wrong here?
Is there a better way to save these in an array?
Maybe using np.array somehow?