import cv2
def nothing(pos):
pass
if __name__ == '__main__':
img = cv2.imread('1.jpg')
edges = img
cv2.namedWindow('Original')
cv2.namedWindow('Canny')
cv2.createTrackbar('Min', 'Canny', 0, 100, nothing)
cv2.createTrackbar('Max', 'Canny', 100, 200, nothing)
while True:
cv2.imshow('Original', img)
cv2.imshow('Canny', edges)
min = cv2.getTrackbarPos('Min', 'Canny')
max = cv2.getTrackbarPos('Max', 'Canny')
edges = cv2.Canny(img, min, max)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()