PiLab-CAU / ComputerVision-2401

Computer Vision Course 2024-01
Apache License 2.0
9 stars 3 forks source link

[Lecture4][0416] Question about difference between Canny edge operator and Harris corner detector #17

Closed imsongpasimin closed 3 months ago

imsongpasimin commented 5 months ago

@yjyoo3312 Hello Professor, my name is Jeon Yonghyeon, and I am currently enrolled in your class. I am writing to inquire about the reasons behind the differences in the algorithms of the Canny edge operator and the Harris corner detector.

image

image

In the image aboves, the algorithm for the Canny edge operator applies a Sobel filter to a Gaussian-smoothed image, whereas for the Harris corner detector, it seems that the gradient is first calculated using the Sobel filter, followed by Gaussian smoothing. What is the reason for these differences in the order of operations between the two algorithms?

My hypothesis is that the Harris corner detector necessitates the calculation of the window function (Gaussian smoothing) later in the process due to transformations in the formula.

image

However, in Lecture 3, there is an image showing the problems that arise when calculating the gradient before smoothing. Does the Harris corner detector not encounter these problems? Or would it be acceptable for the Canny edge detector to also compute the gradient before applying Gaussian smoothing?

Thanks for watching my issue!

kimjyan20221186 commented 5 months ago

Although I'm not a professor, I think it's because the purpose of the detector is different. The goal of the Canny edge detector is to find local maxima, which is significantly influenced by noise, while the Harris corner detector seeks points where both gradient x and gradient y change significantly.

yjyoo3312 commented 5 months ago

@imsongpasimin @kimjyan20221186 Thanks for the question and discussion!

As you guessed, we use Gaussian smoothing in Canny Edge detection to reduce noise, and in the Harris detector, it acts as a window function to accumulate values within the window. This is why we apply Gaussian smoothing before and after Sobel filtering for each case.

If our image is really noisy, particularly with salt and pepper noise, we might need to add another smoothing step before using the Harris corner detector. (For salt and pepper noise, we saw a median filter worked better than a Gaussian filter.)

imsongpasimin commented 5 months ago

@yjyoo3312 @kimjyan20221186 Thanks for your advices!