Canny edge detection
-
- Use a Gaussian filter to smooth the image and filter out noise.
-
- Calculate the gradient intensity and direction of each pixel in the image.
-
- Non-Maximum Suppression is applied to eliminate the spurious response caused by edge detection.
-
- Double-Threshold detection is used to determine the true and potential edges.
-
- Finalize edge detection by suppressing isolated weak edges
1: Gaussian filter
2: gradient and direction
3: Non-maximum suppression
4: Double threshold detection
img=cv2.imread("lena.jpg",cv2.IMREAD_GRAYSCALE)
v1=cv2.Canny(img,80,150)
v2=cv2.Canny(img,50,100)
res = np.hstack((v1,v2))
cv_show(res,'res')
img=cv2.imread("car.png",cv2.IMREAD_GRAYSCALE)
v1=cv2.Canny(img,120,250)
v2=cv2.Canny(img,50,100)
res = np.hstack((v1,v2))
cv_show(res,'res')