Con_Nha_Nong
Con_Nha_Nong

Reputation: 11

Needing too much time to open webcam using Opencv?

I use Opencv to capture image from camera c270 logitech but it needs 3 minutes to open while camera in laptop just need 1 minute. what I need to do to fix this problem?

import numpy as np
import cv2 as cv
 
cap = cv.VideoCapture(0)
if not cap.isOpened():
    print("Cannot open camera")
    exit()
while True:
    # Capture frame-by-frame
    ret, frame = cap.read()
 
    # if frame is read correctly ret is True
    if not ret:
        print("Can't receive frame (stream end?). Exiting ...")
        break
    # Our operations on the frame come here
    gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
    # Display the resulting frame
    cv.imshow('frame', gray)
    if cv.waitKey(1) == ord('q'):
        break
 
# When everything done, release the capture
cap.release()
cv.destroyAllWindows()

This is code from opencv

Upvotes: 0

Views: 32

Answers (0)

Related Questions