I'm Using OpenCv for detecting the face. I'm fetching image from the video. When I'm running the code on my local machine to capture video, it's working fine. But when running the same code after deployment on Heroku it's not working.
Below is the error-
[ WARN:0] global /tmp/pip-req-build-dzetuct2/opencv/modules/videoio/src/cap_v4l.cpp (890) open VIDEOIO(V4L2:/dev/video1): can't open camera by index
Below is the code-
Views.py
class VideoCamera(object):
def __init__(self):
self.video = cv2.VideoCapture(1)
camera_backends = cv2.videoio_registry.getCameraBackends()
print("ca",camera_backends)
(self.grabbed, self.frame) = self.video.read()
threading.Thread(target=self.update, args=()).start()
def __del__(self):
self.video.release()
def get_frame(self):
image = self.frame
_, jpeg = cv2.imencode('.jpg', image)
return jpeg.tobytes()
def update(self):
while True:
(self.grabbed, self.frame) = self.video.read()
I tried using index value 1 and 2 both but did not work for me.
Someone Please help. Thanks in advance.