Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specifying semetrical kernel for Laplacian of Gaussian filter. #10313

Open
MikeVeling opened this issue Jun 16, 2019 · 0 comments
Open

specifying semetrical kernel for Laplacian of Gaussian filter. #10313

MikeVeling opened this issue Jun 16, 2019 · 0 comments

Comments

@MikeVeling
Copy link

My issue is about the scipy.ndimage.gaussian_laplace function in scipy.

I have a full detail write up on stack overflow here:
https://stackoverflow.com/questions/56463123/unexpected-results-in-scipy-ndimage-gaussian-laplace-inproper-2d-processing

I am attempting to apply this filter to a test image (https://imgur.com/nbfxWjB). This filter should act symmetricly, but it appears not to. For example, you get this result (https://imgur.com/3mhpXI3) with the code below. If you transpose the input and then transpose the output back you get this results (https://imgur.com/neZPDIM).

Reproducing code example:

from PIL import Image
from scipy.ndimage import gaussian_laplace

image=Image.open('White Spot.tif')
transformed=gaussian_laplace(image,4)

im = Image.fromarray(transformed)
im.save('transformed_python.TIF')

Scipy/Numpy/Python version information:

import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)
1.2.0 1.16.0 sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)

If you were to apply a similar function in matlab you would end up with a symmetrical image

I = imread('White Spot.tif');

H = fspecial('log',[5 5],0.1);
LoG_img = imfilter(I,H,'replicate');
imshow(LoG_img);
imwrite(LoG_img,'transformed_matlab.TIF');

Results: https://imgur.com/uieZhvK.
I had to change sigma as if sigma is too big in the matlab version the image just ends up black.

I am not sure if this is a bug or if I just don't know how to specify the kernel in scipy.ndimage objects.

This issue might be related to a separate issue I saw from 2016 (#5543).

Thank you for your help!

@MikeVeling MikeVeling changed the title specifying semetrical kernal for Laplacian of Gaussian filter. specifying semetrical kernel for Laplacian of Gaussian filter. Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants