Appdesigner: Workaround Functionality PickableParts?

6 visualizaciones (últimos 30 días)
Happy PhD
Happy PhD el 15 de Oct. de 2019
Respondida: Thao Pham el 31 de Mzo. de 2020
Hi, I am trying to migrate myCameraGUI into AppDesigner. There are some issues in the Migration Report.
For example, the fucntionality Pickableparts is not supported in the App Designer with GUIDETAG cameraAxes. Are there any other similar functionality in the app designer?
I basically want to click on a button, to start and stop a camera stream, and another button to grab the image (snapshot) and save it to .mat file. I have even tried to write the similar code in app designer from scratch but it doesn't react to anything after clicking the button once, so i don't know how to solve that. 'myCameraGUI' does exactly what i want and i don't have any weird loading effects when I want to display the stream in the GUIDE.
I am very new with GUI and App designer, so any help appreciated.

Respuesta aceptada

Hope Q
Hope Q el 28 de Oct. de 2019
It's not clear why you need pickable parts. Does the user need to draw an region on the image or is the area pre-defined?
If the user needs to draw an area, explore the Rectangle object.

Más respuestas (1)

Thao Pham
Thao Pham el 31 de Mzo. de 2020
after Migration, you can see the code of startstop button like this:
% Button pushed function: startStopCamera
function startStopCamera_Callback(app, event)
% hObject handle to startStopCamera (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Start/Stop Camera
if strcmp(get(app.startStopCamera,'String'),'Start Camera')
% Camera is off. Change button string and start camera.
set(app.startStopCamera,'String','Stop Camera')
% Camera is on. Stop camera and change button string.
set(app.startStopCamera,'String','Start Camera')
but it not work with app designer to show start with camera. So you can following these step below to correct it:
  1. Add new properties:
properties (Access = public)
video % Description
properties (Access = private)
  1. Change code of if statement in the startstop button
% Start/Stop Camera
if strcmp(get(app.startStopCamera,'Text'),'Start Camera')
% Camera is off. Change button string and start camera.
%set(app.startStopCamera,'Text','Stop Camera')
app.startStopCamera.Text ='Stop Camera';
try = videoinput('winvideo', 1);
cam = webcam(1);
app.webcamObject = cam;
app.imageObject = image(app.cameraAxes);
res = split(app.webcamObject.Resolution,'x');
app.cameraAxes.XLim = [0,str2double(res{1})];
app.cameraAxes.YLim = [0,str2double(res{2})];
catch ME
% If problem reading image, display error message
uialert(app.myCameraGUI, ME.message, 'Image Error');
triggerconfig(,'manual'); = Inf; % Capture frames until we manually stop it
app.startAcquisition.Enable = 'on';
app.captureImage.Enable = 'on';




Community Treasure Hunt

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

Start Hunting!

Translated by