Canny Edge Image - Noise removal

后端 未结 3 1587
轻奢々
轻奢々 2020-12-05 16:10

I have a Canny edge detected image of a ball (see link below) which contains a lot of noisy edges. What are the best image processing techniques that I can use to remove th

相关标签:
3条回答
  • 2020-12-05 16:55

    The best way to remove those is probably not to have them in the first place if you can. If the lines are noisy artifacts in the image apply a smoothing filter such as a Gaussian to level the image out. -> Gaussian filter info

    Removing them once they are there is tricky and would probably involve some higher level shape recognition stuff

    0 讨论(0)
  • 2020-12-05 17:11

    The best option is to filter the image before applying the edge detector. In order to keep the sharp edges you need to use a more sophisticated filter than the Gaussian blur.

    Two easy options are the Bilateral filter or the Guided filter. These two filters are very easy to implement and they provide good results in most cases: gaussian noise removal preserving edges. If you need something more powerful, you can try the filter BM3D, which is one of the state-of-the-art filters, and you can find an open source implementation here.

    0 讨论(0)
  • 2020-12-05 17:11

    Canny edge detection works best only after you set optimal threshold levels (lower and upper thresholds)

    How do you set them?

    • First, calculate the median of the gray scale image.
    • Choose the optimal threshold values using the median of the image.

    The following pseudo-code shows you how its done:

    v = np.median(gray_img)
    sigma = 0.33
    
    #---- apply optimal Canny edge detection using the computed median----
    lower_thresh = int(max(0, (1.0 - sigma) * v))
    upper_thresh = int(min(255, (1.0 + sigma) * v))
    

    Set lower_thresh and upper_thresh as the parameters for the canny edge function.

    sigma is set to 0.33 because in statistics along a distribution curve, values lying between 33% from the start and end of the curve are considered. Values lying beyond and below this curve as considered to be outliers.

    This is what I got for your image:

    0 讨论(0)
提交回复
热议问题