When I do an edge detection, I normally first use a Gaussian filter:
img_blur = scipy.ndimage.gaussian_filter(img,2,truncate = 2.25)
Then a gradient filter:
Ix= scipy.ndimage.convolve(im, dx)
Iy = scipy.ndimage.convolve(im, dy)
Where dx and dy are the two filters in the horizontal and vertical directions. Then I will compute for the edge:
edges = Ix**2 + Iy**2
My question is there a way to combine the gaussian filter and the gradient filter into one filter? Let's call this filter f, can I do something like:
f= scipy.scipy.ndimage.gaussian_filter(img,2,truncate = 2.25) + scipy.ndimage.convolve(im, dx)
? I know this is not a legal expression, but is there a way to correctly implement this filter f or is there any other filter that has the same effect? I am doing horizontal and vertical filters separately, so f just needs to be one direction at a time. This filter need to go through another convolution to get the final result, which means it needs to go through another
result = scipy.ndimage.convolution(img,filter)
to get the final result.