import cv2
video=cv2.VideoCapture(0)
img=video.read()
video2=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.imshow("camera",video2)
cv2.waitKey(0)
"HERE IS THE ERROR" """ Traceback (most recent call last): File "C:/Users/D_Ommy/PycharmProjects/Machine_Learning/sampleone.py", line 4, in video2=cv2.cvtColor(img, cv2.COLOR_BGR2RGB) TypeError: Expected Ptr<cv::UMat> for argument 'src' [ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-cff9bdsm\opencv\modules\videoio\src\cap_msmf.cpp (435) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
"""
VideoCapture.read()
: Byimg = video.read()
, you'll get a tuple(retval, image)
forimg
, which isn't a valid input forcvtColor()
. – HansHirse