Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

webcam image capture focusing problem

Hi guys

I have written a basic code which captures an image from webcam using python 2.7 .

The code is as follows

import numpy
import cv2
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
cv2.imshow('image',frame)
cap.release()
cv2.waitKey(0)
cv2.destroyAllWindows()

This code gives the correct output but my camera takes a few seconds to focus so i get a black or dim image as output instead of a bright proper focused image..

how can i correct this problem. I am using cv2 and python 2.7