Snapshot timeout when two Gige videoinput objects are in the "start" state

4 次查看(过去 30 天)
Hi,
I am trying to run two GigE cameras using the image acquisition toolbox. I am running into the same problem whether I use the videoinput object with either the general gige adapter or the one provided by FLIR (mwspinnakerimaq), as well as using the gigecam objects. I see the same behavoir with the spmd approach https://www.mathworks.com/matlabcentral/answers/388286-how-can-i-acquire-images-from-multiple-gige-cameras-using-image-acquisition-toolbox-and-parallel-com.
Basically, I can grab frames in a loop from either camera on its own no problem. However, as soon as I put both cameras in the "start" state I will get a timeout error on the getsnaphot command, even if I don't ask the second camera for a snaphot. The code below works just fine until you uncomment the indicated line.
vid1 = videoinput('gige',1);
src1 = getselectedsource(vid1);
set(src1,'ExposureAuto','off')
vid1.IgnoreDroppedFrames = 'on';
vid1.FramesPerTrigger = 1;
triggerconfig(vid1,'manual')
vid2 = videoinput('gige',2);
src2 = getselectedsource(vid2);
set(src2,'ExposureAuto','off')
vid2.IgnoreDroppedFrames = 'on';
vid2.FramesPerTrigger = 1;
triggerconfig(vid2,'manual');
start(vid1)
% start(vid2) % uncommenting this line causes the timeout error
N = 100;
tic
for ii = 1:N
frame1 = getsnapshot(vid1);
end
t = toc;
fprintf('Average Frame Rate = %.1fHz\n',N/t);
stop(vid1)
% stop(vid2)
I feel like I ran into a probelm with the image aquisition toolbox, these particular GigE cameras, or I'm missing some basic setting or something.
Any ideas?

采纳的回答

Rueben Mendelsberg
Rueben Mendelsberg 2021-11-1
The problem turned out to be the default video mode setting for these cameras. If unspecified in the videoinput constructor, these cameras use 'Mono12packed' format as default and this appears to cause problems.
If
vid1 = videoinput('gige',1);
is changed to
vid1 = videoinput('gige',1,'Mono8');
the problem goes away and I am able to take frames from both cameras without a problem.
The system performance is a bit better when using the adapter from FLIR. i.e.
vid1 = videoinput('mwspinnakerimaq',1,'Mono8_Mode0')

更多回答(1 个)

David
David 2023-11-28
I used gigecam() instead for the connection and this problem seemed to dissapear

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by