MATLAB App Designer - Plotting image on uifigure

조회 수: 5 (최근 30일)
Sam Nadjari
Sam Nadjari 2020년 2월 25일
답변: Jyotsna Talluri 2020년 2월 28일
I'm attempting to plot a grayscale image on a uifigure (not on the main UIAxes) using the following code:
f = uifigure('Name','Please draw your desired region of interest with the mouse.');
im = uiimage(f);
im.ImageSource = (app.Images(:,:,app.CurrentImageIndex));
My overall goal here is to allow the user to draw a rectangle to specify a region of interest. I wasn't able to do this on the UIAxes - I'm not sure that there's a way to draw on them, so I'm creating a uifigure instead. The problem is that the ImageSource property must be an mxnx3 color data matrix. So I have two questions: Why does this property need a 3d matrix to work? Is there an alternative way to plot a grayscale image on a uifigure? Any help would be greatly appreciated.

답변 (1개)

Jyotsna Talluri
Jyotsna Talluri 2020년 2월 28일
The ImageSource property of uifigure does not support grayscale image. This is a known issue and might be considered in a future release. The alternative could be changing the image component to UIAxes and then use imshow with the UIAxes as the parent
>> imshow(app.Images(:,:,app.CurrentImageIndex),'Parent',app.UIAxes));

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by