You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
473 B
17 lines
473 B
# coding=gbk
|
|
import cv2
|
|
|
|
def cny(filepath):#ąßÔľźě˛â
|
|
src = cv2.imread(filepath+'image1.png')
|
|
|
|
src = cv2.GaussianBlur(src, (3, 3), 0)
|
|
grayImage = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
|
|
gradx = cv2.Sobel(grayImage, cv2.CV_16SC1, 1, 0)
|
|
grady = cv2.Sobel(grayImage, cv2.CV_16SC1, 0, 1)
|
|
edge_output = cv2.Canny(gradx, grady, 50, 150)
|
|
|
|
cv2.imwrite(filepath + "canny.png", edge_output)
|
|
|
|
if __name__ == '__main__':
|
|
filepath = 'pic/'
|
|
cny(filepath) |