How to run FramesAcquiredFcn on a worker?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Ayush Modi
le 18 Jan 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 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!