Is there a way to adjust shutter speed or exposure time of a webcam using Python and OpenCV

Viewed 20523

In my robotic vision project, I need to detect a marker of a moving object but motion causes blurring effect in the image. Deconvolution methods are quite slow. So I was thinking to use a higher fps camera. Someone said I don't need higher fps, instead I need shorter exposure time.

OpenCV's Python Interface cv2 provides a method to change the settings of camera but it does not include "Exposure Time" or "Shutter Speed" settings. I'm also afraid that webcams don't even support this kind of settings.

Any other thoughts about:

Eliminating blurring effect using camera setting?

OR

Restoration of Image with real-time performance?

OR

Any suggestion about a low cost camera for real-time robotic applications?

2 Answers

For instance

I was trying with a c920 for a while whithout success, but sometimes worked, other not using this:

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_EXPOSURE, -4) 
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240) # after not change the exposure

But finally I realized that I was setting the width and height just after, and so I change the order and now is working fine!! Don´t blow your mind trying to disable the CAP_PROP_AUTO_EXPOSURE flag!! Its not necessary(at least with c920 on windows)!!

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240) # before works fine
cap.set(cv2.CAP_PROP_EXPOSURE, -4) 

By the way, the range of exposure in C920 is from -2 to -11!!(on windows 10)

Thanks a lot

Related