# How do I scale Gaussians for Edge detection

Say I have an $m\times n$ image and I want to use DOG for edge detection. I can see in this answer he is using:

gaussian1 = fspecial('Gaussian', 21, 15);
gaussian2 = fspecial('Gaussian', 21, 20);


I was working with this image for reference, and I tried to move the size from 1 to 30. I cant make sense of which output is better. I think the sharpest edges I received were for hsize=6, but how can I tell?

After following the advice on the comments and reading the wiki entery's abstract on the subject I am still puzzled. It is my understanding that the band pass parameters is dependent in the image and there is no efficient automatic way to derive the sigma and size parameters of the filters from the image.Does this means I have to manually adjust the filter sizes for any new image?

• Is there an automatic way to do so? (I am sure there is since this algorithms work independently on the market)
• say I want to generate response for different filters as an experiment:
• Which iterations should I go through?
• When I am looking at the result image, what should I look for to ssay it is the desired response?
• No, you cannot derive it from the size of an image. Imagine this: you have an image of size $x\times y$, and your edge detector works fine. Now you just go and add a black border of width $b$ around your image. Would you want to choose a different DOG parametrization for an image of size $(x+2b,y+2b) \ne (x,y)$ ? – Marcus Müller Dec 10 '16 at 13:15
• For your first question, I think you might want to read the abstract of the Difference of Gaussians wikipedia article, which says: Thus, the difference of Gaussians is a band-pass filter that discards all but a handful of spatial frequencies that are present in the original grayscale image. I think this spectrally-based sentence should answer your first question. If it does not, could you maybe refer to that explanation and emphasize with what you need help understanding? – Marcus Müller Dec 10 '16 at 13:18
• @MarcusMüller I have tried to emphasis my question as best I could (see edit). Is it clearer now? – havakok Dec 10 '16 at 13:43