Ask Your Question

OpenCV with point and shoot/DSLR

asked 2017-12-05 13:51:05 -0500

Noahyt gravatar image

I want to purchase multiple cameras to use for computer vision application.

However, I want to have complete control over the following: - manual trigger - shutter speed - iso/gain

As such I was going to buy a scientific cameras such as the thorlabs cmos:

However, I suspect it may be possible to achieve similar results by buying a cheap consumer point and shoot or DSLR (which would be much cheaper).

I would like to know whether there are any proven examples of manual control of such cameras through opencv as most examples seem to be webcam-exclusive. Note: I don't want to just have a continuous video stream and "pull" frames using something like

Specifically, I would like to be able

edit retag flag offensive close merge delete


In my personal experience, if you want to access every setting of your camera through software, use the brand specific software API and then pass the retrieved frame to OpenCV for processing, bypassing the need of VideoCapture.

StevenPuttemans gravatar imageStevenPuttemans ( 2017-12-06 04:25:04 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-12-06 03:30:31 -0500

kbarni gravatar image

updated 2017-12-07 06:56:54 -0500

OpenCV has support for the libgphoto2 library. So you can control and capture images with cameras supported by this library using the cv::VideoCapture class.

For even more functionality and control, you can use directly the libgphoto2 library for capturing and convert the captured images to cv::Mat; it's quite easy. Here are some examples.

Here is the list of supported cameras:

Just make sure that you have libgphoto2 library installed and OpenCV is built with libgphoto support.

edit flag offensive delete link more


Are there any python examples which shows how to capture a video from a DSLR? I'd like to use a DSLR instead of a webcam to capture a video for my application.

Koceila gravatar imageKoceila ( 2018-11-28 22:48:45 -0500 )edit

No, there are no python examples, because capturing video from a DLSR is not really possible. They are photo cameras, not video devices. The USB interface isn't fast enough for real time quality video transfer. All you can get is a low resolution preview from the live view.

The DSLRs aren't optimal for machine vision applications anyway: they are bulky, fragile and difficult to power from external source.

If you need good quality video and lot of control, I suggest to use industrial cameras, like Basler, PTGrey, uEye etc. models.

Anyway, the capturing algorithm in OpenCV is the same as for the webcams: open a VideoCapture device, then read the frames in a loop; or use the camera SDK.

kbarni gravatar imagekbarni ( 2018-11-29 07:57:52 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-12-05 13:51:05 -0500

Seen: 1,627 times

Last updated: Dec 07 '17