필터 지우기
필터 지우기

Image acquisition in parallel via FireWire

조회 수: 4 (최근 30일)
PeLa
PeLa 2023년 8월 25일
댓글: Image Analyst 2023년 8월 28일
Hi everyone,
I am trying to capture images from two cameras via firewire with Matlab. For this I use the parallel toolbox. I have oriented myself on the following example: https://de.mathworks.com/matlabcentral/answers/388286-how-can-i-acquire-images-from-multiple-gige-cameras-using-image-acquisition-toolbox-and-parallel-com . I do not use a GigE interface, so I have adapted the code accordingly.
The code I use is the following:
delete(imaqfind);
parpool(2)
spmd(2)
delete(imaqfind);
vid=videoinput('gentl',labindex, 'Mono8')
img=getsnapshot(vid);
end
This does not work, however. Does someone know what might be the error?
Many thanks in advance

답변 (1개)

Image Analyst
Image Analyst 2023년 8월 25일
Post a screenshot of what you see when you run imageAcquisitionExplorer or imaqtool
If there are two cameras you should see two cameras. If they both use the same interface, there should be a unique ID for each one.
imaqfind() is a function and you should not delete it. Maybe you meant to run imaqreset instead?
Type imaqfind into the command window (without deleting it of course) and what does it show?
  댓글 수: 5
PeLa
PeLa 2023년 8월 28일
편집: PeLa 2023년 8월 28일
Thanks for your answer!
I did now the following, which kind of worked but somehow the cameras only take pictures sometimes I press the Run button, do you maybe know what might be the reason for this?
The error message is
Caused by:
Error using imaqdevice/getsnapshot (line 65)
The image acquisition device failed to start acquiring images.
What I also don't understand is why I have to call the cameras in both workers with the same number, i.e. in both workers I have to use videoinput('gentl',1, 'Mono8'), if I use videoinput('gentl',2, 'Mono8') for one camera, then there appears an error message.
if isempty(gcp('nocreate'))
parpool(2)
end
spmd(2)
if labindex==1
vid1=videoinput('gentl',1, 'Mono8')
else
vid2=videoinput('gentl',1, 'Mono8')
end
end
spmd(2)
if labindex==1
img1=getsnapshot(vid1);
else
img2=getsnapshot(vid2);
end
end
Many thanks in advance
Image Analyst
Image Analyst 2023년 8월 28일
I don't know how your user interface works. You don't have to snap images from both camera at the same time. You can snap them one at a time, you just need to be sure that when you get the image from camera #1 you use vid1 and when you get the image from camera #2 you use vid2. You can do that by making them globals and call this just in your startup routine.
app.vid1 = videoinput('gentl', 1, 'Mono8'); % Initialize video input object for camera 1.
app.vid2 = videoinput('gentl', 2, 'Mono8'); % Initialize video input object for camera 2.
After that use app.vid1 and app.vid2 (the global instances of those video input objects) in your button callback functions or wherever else you want (as long as app is in scope).
Tech support told me that you only need to get the video inputs once -- you do not want to call them every time you click a button on your GUI. Use getdata or getsnapshot as many times as you want without ever getting (or overwriting) the video input objects.

댓글을 달려면 로그인하십시오.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by