Steger_line_algorithm icon indicating copy to clipboard operation
Steger_line_algorithm copied to clipboard

Wrong convolution kernels

Open Daniel63656 opened this issue 3 years ago • 2 comments

The kernels are not the kernels specified in the paper (eq 25 - 29). In fact they are in weird column/row - vector shapes when they should be square matrices.

Daniel63656 avatar Oct 05 '22 14:10 Daniel63656

It's not wrong in term of edge extraction but it's not similar to the one used in the paper. Yet, the output behavior is still the same : 1D Gaussian filter * 1D x-derivative = sobel x and 1D y-derivative * 1D Gaussian filter = sobel y.

ParadoxRobotics avatar Oct 05 '22 14:10 ParadoxRobotics

Thanks for clarifying. I need to understand that myself why this is equivalent. I have also implemented the kernels like in the paper:

temp = np.arange(-kernelSize, kernelSize+1) X,Y = np.meshgrid(temp, temp, indexing='ij')

# create filter for derivative calulation
dxFilter = 1/(2*np.pi*sigma**4)*(-X) * np.exp(-(X**2 + Y**2)/(2*sigma**2));
dyFilter = 1/(2*np.pi*sigma**4)*(-Y) * np.exp(-(X**2 + Y**2)/(2*sigma**2));
dxxFilter= 1/(2*np.pi*sigma**4) * (X**2/Sigma**2 - 1) * np.exp(-(X**2 + Y**2)/(2*sigma**2));
dyyFilter= 1/(2*np.pi*sigma**4) * (Y**2/Sigma**2 - 1) * np.exp(-(X**2 + Y**2)/(2*sigma**2));
dxyFilter= 1/(2*np.pi*sigma**6) * (X * Y)             * np.exp(-(X**2 + Y**2)/(2*sigma**2));

Daniel63656 avatar Oct 05 '22 15:10 Daniel63656