Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change camera parameters (auto exposure, shutter speed, gain)?

I am using Matlab to capture images from 2 Point Grey Cameras (Flea2) and I would like to change some parameters of the cameras such as Auto Exposure, Gain and Shutter Speed. So far I have used these commands:

%Creating the two video input of the two cameras
cam1 = videoinput('dcam',1,'Y8_640x480');
cam2 = videoinput('dcam',2,'Y8_640x480');
%get devices properties
src1 = getselectedsource(cam1);
src2 = getselectedsource(cam2);
%define and set parameters to be changed
properties = {'AutoExposureAbsolute','AutoExposureControl', 'AutoExposureMode', 'GainAbsolute', 'GainControl', 'GainMode','ShutterAbsolute','ShutterControl', 'ShutterMode'};
values = {0,'absolute', 'manual', 0,'absolute', 'manual', 0, 'manual', 5e-06, 'absolute', 'manual'};
set(src1, properties, values)
set(src2, properties, values)

So, if I display src1 and src2 variables the above properties has been modified but when I preview the cameras nothing has changed.

While using always the same syntax for changing the frame rate I am successful.

like image 451
Paolo Ferraiuoli Avatar asked Feb 27 '16 18:02

Paolo Ferraiuoli


1 Answers

I solved this problem installing the Image Acquisition Toolbox Support Package for Point Grey Hardware. Then, you need to change the adapter type using the Point Grey driver:

cam = videoinput('pointgrey',1,'Mono8_640x480');

Now, you can set normally the properties of the cameras (auto exposure, shutter speed, gain) through Matlab. For example, if you want so set a specific value of the Shutter:

src = getselectedsource(cam);
set(src, 'Shutter', value)

Concerning my question I suppose that the device specific properties of Point Grey cameras cannot be edited directly through MATLAB with the dcam driver, but in order to modify such properties you need to use the Matlab support package for Point Grey Hardware.

like image 162
Paolo Ferraiuoli Avatar answered Nov 05 '22 07:11

Paolo Ferraiuoli