PythonOpenCV

6. Edge detection

2020-01-14  本文已影响0人  JaedenKil
import cv2


img = cv2.imread("C:\\Users\\zzheng\\Pictures\\tiger.png", cv2.IMREAD_UNCHANGED)
edges = cv2.Canny(img, 100, 200, True)
cv2.imshow("Edge Detection", edges)
cv2.waitKey(0)
cv2.destroyAllWindows()

edges = cv2.Canny('/path/to/img', minVal, maxVal, apertureSize, L2gradient)
/path/to/img (Mandatory): File Path of the image
minVal (Mandatory): minVal (Mandatory)
maxVal (Mandatory): Maximum intensity gradient
apertureSize (Optional):
L2gradient (Optional) (Default Value : false): If true, Canny() uses a much more computationally expensive equation to detect edges, which provides more accuracy at the cost of resources.

上一篇 下一篇

猜你喜欢

热点阅读