Unable to use pyfakeWebcam with opencv
If you are getting this error while using pyfakewebcam with opencv from this well explained blog
TypeError: Expected Ptr<cv::UMat> for argument '%s'
import cv2
import pyfakewebcam
import numpy as np
gray = pyfakewebcam.FakeWebcam('/dev/video0', 640, 480)
while(True):
# Capture frame-by-frame
print('Type of gray ->', type(gray))
gray = cv2.resize(gray, (500, 300))
cv2.imshow("Pyfakewebcam", gray)
key = cv2.waitKey(1)
if key == 27:
break
gray.release()
cv2.destroyAllWindows()
If you look closely, I have printed the type of the image that we are getting from pyfakewebcam
. It is not a np.ndarray
as we get from opencv.
Hence we cannot use this pyfakewebcam for opencv operations.