How to run FramesAcquiredFcn on a worker?

3 次查看(过去 30 天)
System which we want to develop is controlling workpieces with cameras. There are 2 different cameras at different position. So synchronization mut be protected. I wonder that is it possible to run FramesAcquiredFcn function on backside? like
app.vid.FramesAcquiredFcn = parfeval(@func7);%????
or something like that. I know this line is not works but just gives us an idea for question.
Thanks.

回答(1 个)

Ayush Modi
Ayush Modi 2024-1-18
Hi Ahmet,
As per my understanding, you would like to assign "parfeval" function handle to “FramesAcquiredFcn” property.
The "FramesAcquiredFcn" property is used to specify a callback function that gets executed every time a specified number of frames have been acquired by the video input object. This callback function is asynchronous with respect to the main MATLAB thread.
However, "FramesAcquiredFcn" does not accept "parfeval" function as a valid input.
As a possible workaround, you can use parfeval inside the callback function itself. Here is the example to demonstrate how you can achieve this:
function func7(src, event, app)
% Assuming 'app' is passed to the callback and contains the necessary context
f = parfeval(@heavyComputation, nargout, args...); % Run 'heavyComputation' on a parallel pool worker
% Other code that can run while 'heavyComputation' is processing
end
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for IP Cameras 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by