小编Ris*_*had的帖子

AttributeError:“NoneType”对象没有属性“copy”

完整的错误是:


    OpenCV: out device of bound (0-0): 1
    OpenCV: camera failed to properly initialize!
    Traceback (most recent call last):
      File "/Users/syedrishad/PycharmProjects/OpenCVPython/venv/project1.py", line 60, in <module>
        imgResult = img.copy()
    AttributeError: 'NoneType' object has no attribute 'copy'
     ```

Run Code Online (Sandbox Code Playgroud)

完整代码是:

```import cv2
import numpy as np

frameWidth = 640
frameHeight = 480
cap = cv2.VideoCapture(1)
cap.set(3, frameWidth)
cap.set(4, frameHeight)
cap.set(10, 150)

myColors = [[78, 119, 70, 255, 97, 255],
            [63, 108, 44, 255, 0, 118],
            [0, 179, 69, 255, 100, 255],
            [90, 48, …
Run Code Online (Sandbox Code Playgroud)

python opencv object attributeerror nonetype

1
推荐指数
1
解决办法
5万
查看次数

标签 统计

attributeerror ×1

nonetype ×1

object ×1

opencv ×1

python ×1