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?
  • 1
    $\begingroup$ 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)$ ? $\endgroup$ Dec 10 '16 at 13:15
  • 1
    $\begingroup$ 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? $\endgroup$ Dec 10 '16 at 13:18
  • $\begingroup$ @MarcusMüller I have tried to emphasis my question as best I could (see edit). Is it clearer now? $\endgroup$
    – havakok
    Dec 10 '16 at 13:43

Does this means I have to manually adjust the filter sizes for any new image?

yes! You need to know the kind of edges you want to detect. And that "kind of edge" is a "width of the edge in pixels" in disguise. So, you need more "intelligence" than just a DOG if you want to detect your favourite kind of edge in pictures of any zoom / resolution.

Is there an automatic way to do so?

Plenty! You could, for example, simply try out some parametrizations for your DOG and automatedly select the parametrization that leads to an edge image that fits your signal model best – for example, if you want to find square boxes in images, looking for the "cleanest" straight lines.

Again, all depends on what you want to detect, and how you model your signals. There's no "universally" best edge detector. (or else, that would be the only one everyone uses, right?)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.