Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AttributeError: 'cv2.VideoCapture' object has no attribute 'isOpend'

I have a problem using OpenCV with VS Code
I checked version of OpenCV and Python, but I don’t know what’s wrong.

opencv version is 4.7.0
vscode interpreter is python 3.9.13(‘base’) /opt/anaconda3/bin/python
here is condalist
opencv-contrib-python 4.7.0.72 pypi_0 pypi
opencv-python 4.7.0.72 pypi_0 pypi

this is my code

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import cv2
import sys
cap = cv2.VideoCapture(0)

if not cap.isOpend():
    print("Camera is not opend")
    sys.exit(1)
    
while True : 
    res, frame = cap.read()
    
    if not res : 
        print("Camera error")
        break
    
    cv2.imshow("frame", frame)
    
    key = cv2.waitKey(1) & 0xFF
    if key == 27:
        break
cv2.destroyAllWindows()
cap.release()

and the error is:

AttributeError: ‘cv2.VideoCapture’ object has no attribute ‘isOpend’

>Solution :

It’s isOpened– not isOpend. docs. I suppose you were trying to copy this example and copied it wrong (why didn’t you just copy and paste?).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading