我正在尝试将OpenCV与Python结合使用,以便检测来自Raspberry Pi摄像机的实时视频源中的正方形。但是,下面的代码中的cv2.GaussianBlur
和cv2.Canny
函数导致以下错误:“ TypeError:numpy.ndarray'对象不可调用”。
我似乎无法解决该错误。任何帮助表示赞赏。
import cv2
# load the video
camera = cv2.VideoCapture(0)
# keep looping
while True:
# grab the current frame and initialize the status text
(grabbed, frame) = camera.read()
status = "No Targets"
# check to see if we have reached the end of the
# video
if not grabbed:
break
# convert the frame to grayscale, blur it, and detect edges
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
blurred = …
Run Code Online (Sandbox Code Playgroud)