Skip to main content
2 de 2
Precisar el título y formatear código.
Candid Moe
  • 26.6k
  • 10
  • 23
  • 47

cv2 no inicializa la cámara

import numpy as np
import cv2

cap = cv2.VideoCapture(0)
while (True):
    ret, frame = cap.read()
    cv2.imshow("visor",frame)
    if cv2.waitKey(1) & 0xFF == ord ("q"):
        break

cap.release()
cv2.destroyAllWindows()

no me deja iniciar la camara y no se como arreglarlo.

error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
Traceback (most recent call last):
  File "C:\Users\TEMP.idea-PCgonzalez\Desktop\python(prueba#1)\krakent.py", line 7, in <module>
    cv2.imshow("visor",frame)
cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-sn_xpupm\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'