I get this error:
OpenCV Error: Unsupported format or combination of formats() in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\imgproc\src\canny.cpp, line 67 Traceback (most recent call last): edges= cv2.Canny(frame,100,100) cv2.error : C:\ slave\WinInstallerMegaPack\srx\opencv\modules\imgproc\src\canny.cpp:67: error: (-210)
When I run this code:
import cv2 import numpy as np cap = cv2.VideoCapture(0) while(1): _, frame = cap.read() cv2.imshow('Original',frame) edges = cv2.Canny(frame,100,100) cv2.imshow('Edges',edges) k = cv2.waitKey(5) & 0xFF if k == 27: break cv2.destroyAllWindows() cap.release()
framemust be grayscale. Usecv2.cvtColor(... cv2.COLOR_BGR2GRAY), before calling Canny