Best value for threshold in Canny

后端 未结 3 1102
一生所求
一生所求 2021-01-02 06:43

I have an image which I want to detect edges on that. I found Canny has been used a lot ( I don\'t know whether I have a better option than that). I have set the values as f

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-02 07:14

    I think this should be taken case by case, if you post some sample images would be useful, but I will try to answer anyways. Here is from Opencv Documents

    Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size );
    where the arguments are:
    
    detected_edges: Source image, grayscale
    detected_edges: Output of the detector (can be the same as the input)
    lowThreshold: The value entered by the user moving the Trackbar
    highThreshold: Set in the program as three times the lower threshold (following Canny’s recommendation)
    kernel_size: We defined it to be 3 (the size of the Sobel kernel to be used internally)
    

    What usually works for me is highThreshold = 255 and lowThreshold = 255/3

提交回复
热议问题