小编DSm*_*ith的帖子

如何在不同的OpenCV版本中使用`cv2.findContours`?

我正在尝试将OpenCV与Python结合使用,以便检测来自Raspberry Pi摄像机的实时视频源中的正方形。但是,下面的代码中的cv2.GaussianBlurcv2.Canny函数导致以下错误:“ TypeError:numpy.ndarray'对象不可调用”

我似乎无法解决该错误。任何帮助表示赞赏。

代码取自https://www.pyimagesearch.com/2015/05/04/target-acquired-finding-targets-in-drone-and-quadcopter-video-streams-using-python-and-opencv/#comment- 446639

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)

python opencv numpy opencv-contour

3
推荐指数
1
解决办法
5141
查看次数

标签 统计

numpy ×1

opencv ×1

opencv-contour ×1

python ×1