Preview webcam in app designer
8 ビュー (過去 30 日間)
古いコメントを表示
Hey,
I want to plot a webcam in app designer by preview in axis, but when i do it my x axis and y axis are gone.
how i can plot with showing x axis and y axis.
This is my code :
app.img = webcam;
app.frame = snapshot(app.img);
app.im = image(app.Main_image, zeros(size(app.frame),'uint8'));
axis(app.Main_image,'image');
preview(app.img,app.im);
before
after
![Before](https://www.mathworks.com/matlabcentral/answers/uploaded_files/727369/Before.png)
![After](https://www.mathworks.com/matlabcentral/answers/uploaded_files/727374/After.png)
- the preview is working, i just blocked the camera.
Thank you.
0 件のコメント
回答 (1 件)
Animesh
2024 年 2 月 16 日
The possible reason for axes to disappear is that the “preview” function is overriding the axis properties. In this case you can try to update the axis properties after calling “preview”.
You can do something like this after calling “preview”:
% To bring back the axes by setting the properties after preview
drawnow; % Ensure the preview updates the UI
app.UIAxes.XTick = [];
app.UIAxes.YTick = [];
app.UIAxes.Visible = 'on'; % Make the axes visible again
Here, the “drawnow” command forces MATLAB to update the Figure Window which might be necessary for the changes to take effect.
I have attached an example “mlapp” for your reference.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!