hala mourad
hala mourad

Reputation: 1

error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

the code is :

import numpy
import cv2 as cv

cap=cv.VideoCapture(0)
while True :
    #ret will get non or value
    ret,frame=cap.read()
    #for make frames gray who did this library make RGB=>BGR
    gray=cv.cvtColor(frame,cv.COLOR_BGR2GRAY)
    cv.imshow('fram',gray)
    #if the user click q or exit the vedio 
    if cv.waitKey(1)&0xFF==ord('q'):
        break
    cap.release()
    cv.destroyAllWindows()

the error is: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' . enter image description here

Upvotes: 0

Views: 1412

Answers (1)

singrium
singrium

Reputation: 3036

Use cv.VideoCapture(0) instead of cv.videoCapture(0). Your mistake is that you lower-cased the V, which should be upper-cased.
Source: Opencv Documentation

Upvotes: 1

Related Questions