How to best set up an App to aquire a live video feed and process its data

조회 수: 7 (최근 30일)
Sebastian
Sebastian 2024년 11월 21일
댓글: Sebastian 2024년 11월 27일
Hi,
I'am tasked with creating a standalone app in Matlab R2022b to collect the video stream and process the data/analyze it. The app is supposed to run for extended periods of time.
I want to base the main part around a switch. Is this a viable solution? Meaning if the switch is turned on, I want to do some setup task and then enter a loop that keeps on repeating. If the switch is turned off by the user, the loop should end and some code to finsish off the calculations should be done in the end too. If the switch is toggled again, the system should be able to restart.
When I tried similar things to this before, the app would freeze up. It would not respond to the toggle button changing.
So is this about the right way to adress such a task, or should I handle it differently? Is there a way to keep the rest of the app responsive, while this loop is executed?
Thank you for your help!
% Value changed function: Switch_on_off
function Switch_on_offValueChanged(app, event)
if app.Switch_on_off.Value == 1
% do preperations
else
%do clean up
end
while app.Switch_on_off.Value == 1
% do preperations
%check for job request
if job_available == 1
% repeated process for duration of job:
while job_ongoing == true
%grab video frame and update viewer in
%App
%do image processing
%temporary store results
if app.Switch_on_off.Value == 0 %end loop if toggled
break
end
end
try
% return results to API
end
else
%grab video frame and update viewer in APP
end
end
end
end

답변 (1개)

Oliver Jaehrig
Oliver Jaehrig 2024년 11월 21일
편집: Oliver Jaehrig 2024년 11월 22일
You need to use Parallel Computing to make apps responsive. It currently sounds like you are not using parallel computing features, do you?
I recommend to check this documentation page and examples so you can see what I mean:
  댓글 수: 1
Sebastian
Sebastian 2024년 11월 27일
Yes in my test I was not using the parallel computing features.
I will look into it!
Thank you for your help!

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

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by