Hello, so I am creating a GUI where I want to have a preview of a video, but without it opening up in another window. Is that possible? preview() opens another window, and I tried to experiment with imshow, but I'm not sure on how to really do this. My computer is attached to a camera device and I already have that setup. Thank you!

 채택된 답변

Kevin Holly
Kevin Holly 2022년 8월 19일

0 개 추천

You can use the command:
preview(vid, hImage);
where hImage is the handle to the image object in which the data is to be displayed.
How are you creating your UI? Are you using App Designer?

댓글 수: 4

Chloe Soriano
Chloe Soriano 2023년 2월 8일
Hello, yes I am using App Designer. I tried using hImage and I was using an axes object as the handle, but I get an error saying, "The specified image handle must be a valid 1XN image object handle, where N represent the specified video input's object's length." I'm not sure on how to check the dimensions of an axes object if that what it was referring to.
You do not pass in an axes handle for the second parameter of preview(): you pass in the handle an image() object. For example,
ax = app.UIAxes2;
z = zeros(640,480,3);
hImage = image(z);
preview(vid, hImage);
It turns out to be possible for vid to be a vector of videoinput() results; in that case, hImage would have to be a row vector of image() objects the same length as vid is. This is something that would be used if you were previewing several video input devices simultaneously.
Chloe Soriano
Chloe Soriano 2023년 2월 22일
I was able to get it to display into the UIAxes; however, it only records a small, "zoomed in" section of the vidoe input and only fits a small part of the UIAxes/doesn't extend to the edges. How to fix this?
Luiz
Luiz 2024년 6월 26일
I am also currently trying to display a preview of my webcam and hamamatsu camera into a UIAxes within my GUI. How were you able to achieve this?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

릴리스

R2022a

질문:

2022년 8월 19일

댓글:

2024년 6월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by