1 | initial version |
you'll probably facepalm ....
>>> help(cv2.Canny)
Help on built-in function Canny:
Canny(...)
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
since you try to skip the 'edges' argument, you have to reference apertureSize by 'key=value', so:
import cv2
import numpy as np
thresh1 = 100
thresh2 = 200
aperture1 = 3
aperture2 = 7
img = cv2.imread("im/lena.png", 0)
edges1 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture1)
edges2 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture2)
cv2.imshow("result aperture 3", edges1)
cv2.imshow("result aperture 7", edges2)
cv2.waitKey()
2 | No.2 Revision |
you'll probably facepalm ....
>>> help(cv2.Canny)
Help on built-in function Canny:
Canny(...)
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
since you try to skip the 'edges' argument, you have to reference apertureSize (or all following params) by 'key=value', 'key=value', so:
import cv2
import numpy as np
thresh1 = 100
thresh2 = 200
aperture1 = 3
aperture2 = 7
img = cv2.imread("im/lena.png", 0)
edges1 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture1)
edges2 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture2)
cv2.imshow("result aperture 3", edges1)
cv2.imshow("result aperture 7", edges2)
cv2.waitKey()
3 | No.3 Revision |
you'll probably facepalm ....
>>> help(cv2.Canny)
Help on built-in function Canny:
Canny(...)
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
since you try to skip the 'edges' argument, you have to reference apertureSize (or all following params) args by 'key=value', so:
import cv2
import numpy as np
thresh1 = 100
thresh2 = 200
aperture1 = 3
aperture2 = 7
img = cv2.imread("im/lena.png", 0)
edges1 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture1)
edges2 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture2)
cv2.imshow("result aperture 3", edges1)
cv2.imshow("result aperture 7", edges2)
cv2.waitKey()
4 | No.4 Revision |
you'll probably facepalm ....it's only a python problem, nothing to do with Canny :
>>> help(cv2.Canny)
Help on built-in function Canny:
Canny(...)
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
since you try to skip the 'edges' argument, you have to reference all following args by 'key=value', so:
import cv2
import numpy as np
thresh1 = 100
thresh2 = 200
aperture1 = 3
aperture2 = 7
img = cv2.imread("im/lena.png", 0)
edges1 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture1)
edges2 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture2)
cv2.imshow("result aperture 3", edges1)
cv2.imshow("result aperture 7", edges2)
cv2.waitKey()
5 | No.5 Revision |
it's only a python (syntax) problem, nothing to do with Canny :
>>> help(cv2.Canny)
Help on built-in function Canny:
Canny(...)
Canny(image, threshold1, threshold2[, edges[, apertureSize[, L2gradient]]]) -> edges
since you try to skip the 'edges' argument, you have to reference all following args by 'key=value', so:
import cv2
import numpy as np
thresh1 = 100
thresh2 = 200
aperture1 = 3
aperture2 = 7
img = cv2.imread("im/lena.png", 0)
edges1 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture1)
edges2 = cv2.Canny(img, thresh1, thresh2, apertureSize=aperture2)
cv2.imshow("result aperture 3", edges1)
cv2.imshow("result aperture 7", edges2)
cv2.waitKey()