classdef imApp < matlab.apps.AppBase
properties (Access = public)
UIFigure matlab.ui.Figure
StartButton matlab.ui.control.Button
UIAxes1 matlab.ui.control.UIAxes
UIAxes2 matlab.ui.control.UIAxes
end
properties (Access = private)
cam;
end
methods (Access = private)
function StartButtonPushed(app, event)
app.cam = webcam;
frame = snapshot(app.cam);
im1 = image(app.UIAxes1, zeros(size(frame),'uint8'));
im2 = image(app.UIAxes2, zeros(size(frame),'uint8'));
axis(app.UIAxes1,'image');
axis(app.UIAxes2,'image');
preview(app.cam,im1);
preview(app.cam,im2);
end
end
methods (Access = private)
function createComponents(app)
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 800 800];
app.UIFigure.Name = 'UI Figure';
app.StartButton = uibutton(app.UIFigure, 'push');
app.StartButton.ButtonPushedFcn = createCallbackFcn(app, @StartButtonPushed, true);
app.StartButton.Position = [271 430 100 22];
app.StartButton.Text = 'Start';
app.UIAxes1 = uiaxes(app.UIFigure);
title(app.UIAxes1, 'Title')
xlabel(app.UIAxes1, 'X')
ylabel(app.UIAxes1, 'Y')
app.UIAxes1.Position = [51 35 511 363];
app.UIAxes2 = uiaxes(app.UIFigure);
title(app.UIAxes2, 'Title')
xlabel(app.UIAxes2, 'X')
ylabel(app.UIAxes2, 'Y')
app.UIAxes2.Position = [600 35 511 363];
app.UIFigure.Visible = 'on';
end
end
methods (Access = public)
function app = untitled
createComponents(app)
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
function delete(app)
delete(app.UIFigure)
end
end
end