How to run FramesAcquiredFcn on a worker?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposte (1)
Ayush Modi
il 18 Gen 2024
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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!