Events in preview function in App Designer
5 ビュー (過去 30 日間)
古いコメントを表示
Hello, I want create App Designer app which preview live camera image. There is function called preview which create new window with live data Link. There is a lot of questions (with solutions) how use this function to display live camera image in application window (1, 2). However, I would also like to display information that is contained in the original preview window such as Resolution, Status and Timestamp. The nice tutorial was made but it only applies to GUIDE or Programmatic Workflow (Link). Does anyone have any idea how to do this in App Designer ?
0 件のコメント
回答 (1 件)
Shivangi Gupta
2021 年 8 月 27 日
編集済み: Shivangi Gupta
2021 年 8 月 27 日
While calling the custom preview function, use the prefix 'app.'. Also, while defining the 'vid' variable, define it as a property. This ensures that it can be accessed anywhere.
app.vid = videoinput('winvideo',1);
% Create blank image
hImage = image(app.UIAxes,zeros(720,1280,3)); %If image resolution is 1280x720
pause(2)
% These lines set proper aspect ratio
app.UIAxes.XLim = [0,1280];
app.UIAxes.YLim = [0,720];
app.UIAxes.XTick = [];
app.UIAxes.YTick = [];
pbaspect(app.UIAxes,[1280,720,1])
preview(app.vid,hImage)
% Set up the update preview window function.
setappdata(hImage, 'UpdatePreviewWindowFcn', @app.preview_fcn);
% Make handle to text label available to update function.
setappdata(hImage,'HandleToTimestampLabel',app.TimeStamp);
Refer to the original answer for further reference:
Details about the custom function “preview_fcn” can be found out from the link below:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!