Ask Your Question
0

Repeatedly setting FPS makes webcam images darker

asked 2017-11-30 16:43:16 -0600

Noahyt gravatar image

I am using opencv3 and the logitech c920 webcam.

I want to change the fps of the webcam every 10 seconds but every time I change the FPS the images I am recording get darker. This is a constant dimming regardless of whether I am increasing or decreasing the FPS.

Code that reproduces the problem:

for fps_iter in range(30):

cap.set(cv2.CAP_PROP_FPS,30-fps_iter)
_, im = cap.read()
cv2.imshow(im)
cv2.waitKey(0)
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-11-30 20:44:04 -0600

supra56 gravatar image
import cv2
from time import sleep 

# Set the time delay between frames
delay = 2.5

#select folder to write to
folder = ''

cap = cv2.VideoCapture(0)

#set the width and height
cap.set(4, 1280)
cap.set(3, 1024)

ret, frame = cap.read()
count = 0
while True:
    ret, frame = cap.read()
    frame_num = "%08d" % (count)
    cv2.imwrite(folder + frame_num + '.jpg', frame)
    k = cv2.waitKey(1)
    count += 1
    sleep(delay)

cap.release()
cv2.destroyAllWindows()
edit flag offensive delete link more

Comments

And how does this solve his issue?

StevenPuttemans gravatar imageStevenPuttemans ( 2017-12-01 07:42:34 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-11-30 16:43:16 -0600

Seen: 317 times

Last updated: Nov 30 '17