Best value for threshold in Canny

后端 未结 3 1124
一生所求
一生所求 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:26

    You can use this equation it is useful and you can apply bluer to enhance it.

    blurred_img = cv2.blur(img,ksize=(5,5))
    med_val = np.median(img) 
    lower = int(max(0 ,0.7*median_pix))
    upper = int(min(255,1.3*median_pix))
    edges = cv2.Canny(image=img, threshold1=lower,threshold2=upper)
    

提交回复
热议问题