Clear Filters
Clear Filters

Need to take simultanous snapshots from 2 gigE Devices-will parfor work? how?

1 view (last 30 days)
Hello there,
Im not a good programmer and need your help. Having two gige cams connected to my computer, I need them to take one snapshot each simultanously. No external trigger is currently available.
Trying to implement a parfor loop to aquire the simultanous snapshots but it doenst work.
Here the code:
clc,clear all,imaqreset
% Accessing both cams
cam = [videoinput('gige', 1),videoinput('gige', 2)];
% Display all valid trigger configurations.
triggerconfig(cam1, 'manual')
triggerconfig(cam2, 'manual')
% View the current trigger configuration.
currentConfiguration_cam1 = triggerconfig(cam1)
currentConfiguration_cam2 = triggerconfig(cam2)
% Initiate the acquisition.
% Verify no frames have been logged.
frameslogged_cam1 = cam1.FramesAcquired
frameslogged_cam2 = cam2.FramesAcquired
% Trigger the acquisition.
parfor ii=sizecam
% Wait for the acquisition to end.
% Determine the number frames acquired.
frameslogged_cam = cam.FramesAcquired
% frameslogged_cam2 = cam2.FramesAcquired
this is the error I get:
An UndefinedFunction error was thrown on the workers for 'getsnapshot'. This might be because the file containing 'getsnapshot' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be attached. See the documentation for 'parallel.Pool/addAttachedFiles' for more details.
Caused by: Undefined function 'getsnapshot' for input arguments of type 'struct'.
How can I solve this issue? Is there any other way to get the snapshots?
Thank you in advance

Answers (1)

Andrei on 2 Jun 2018

Community Treasure Hunt

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

Start Hunting!