7

I am currently writing a research paper about a new steganography algorithm. I have used canny edge detector at some point in my algorithm. In the paper I need to write the time complexity of the novel approach, which in turns depends on the time complexity of canny edge detector.

Problem is that nowhere on the web I could find any reference about the time complexity of canny. I've even read the original canny paper. I am unable to deduce it properly and need some help here.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
Mangat Rai Modi
  • 5,397
  • 8
  • 45
  • 75

1 Answers1

13

Canny edge detection consists of

  1. A convolution of the image with a blur kernel,
  2. Four convolutions of the image with edge detector kernels,
  3. Computation of the gradient direction,
  4. Non-maximum suppression, and
  5. Thresholding with hysteresis,

Steps (1), (2), (3), and (4) are all implemented in terms of convolutions of the image with kernels of a fixed size. Using the FFT, it's possible to implement convolutions in time O(n log n), where n is the number of elements. If the image has dimensions m × n, the time complexity will be O(mn log mn) for these steps.

The final step works by postprocessing the image to remove all the high and low values, then dropping all other pixels that aren't near other pixels. This can be done in time O(mn).

Therefore, the overall time complexity is O(mn log mn).

Hope this helps!

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
  • 1
    Thanks a lot! Although I don't need it now as the question was asked a several months ago but this answer will act as reference to lot of people. Since there is no proper analysis on Canny's time complexity. – Mangat Rai Modi Nov 25 '13 at 10:03
  • @templatetypedef Can you estimate the O-space complexity of your Canny algorithm? – Léo Léopold Hertz 준영 Aug 12 '15 at 18:51
  • @templatetypedef How can Non-Maximum suppression be implemented in terms of convolution? I couldn't figure out how to do this. – TheWaveLad Apr 28 '16 at 15:51