How to select camera like drop down button APP designer?

3 ビュー (過去 30 日間)
Jenifer NG
Jenifer NG 2022 年 8 月 17 日
コメント済み: Jenifer NG 2022 年 10 月 17 日
Hi All,
I am learning to design an app that can select the avaiable camera from computer as fig bellow.
Could you help me or give some guide ?
Thanks !

採用された回答

Ajay Gajulapally
Ajay Gajulapally 2022 年 10 月 17 日
Please Ensure you have the add-on: MATLAB Support package for USB Webcams" installed before following the procedure.
  1. Create a property cam in the app designer:
properties (Access = private)
cam % Description
end
2. Create a startupFunction for the app which by default opens webcam 1
Include this code in the function.
app.cam = webcam(1);
preview(app.cam);
3. Create a Value Change function for the drop down and update the code:
function CameraDropDownValueChanged(app, event)
delete(app.cam);
value = app.CameraDropDown.Value;
if value == "Cam 1"
app.cam = webcam(1);
else
app.cam = webcam(2);
end
preview(app.cam);
end
4. Now try running the app. Hope this helps!
  1 件のコメント
Jenifer NG
Jenifer NG 2022 年 10 月 17 日
thanks you it work for me!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by