How to use UIAxes to display image in app viewer

8 Ansichten (letzte 30 Tage)
Scott Chegwidden
Scott Chegwidden am 29 Mai 2020
I am trying to reproduce a figure in my .m script in App Designer .mlapp script. I want to display a gray scale image and overlay on that image a yellow box, and also overlay a contour of the image all in one figure. I can do this in my .m script with imoshow(insertshape(img)); hold, contour(img) as shown below:
figure(6)
imshow(insertShape(ImgOut(:,:,round(Planes/2)),'FilledRectangle', mbox, 'Color', 'yellow', 'Opacity', 0.2),[])
title(['Site',num2str(s),' measurement ROI box placement'])
hold all
contour(ImgOut(:,:,round(Planes/2)),[TH,TH],'LineColor','white')
I want to imbed this figure in my App Designer .mlapp script using UIAxes command. I can display the image with the yellow box but I can't overlay the contour. This is what I've tried and it only displays the image with box, no contour:
imshow(insertShape(ImgOut(:,:,round(Planes/2)),'FilledRectangle', mbox, 'Color', 'yellow', 'Opacity', 0.2),[],'Parent',app.UIAxes)
hold all
contour(ImgOut(:,:,round(Planes/2)),[TH,TH],'LineColor','white')

Antworten (1)

Cris LaPierre
Cris LaPierre am 29 Mai 2020
Bearbeitet: Cris LaPierre am 29 Mai 2020
I suspect you need to specify the parent axes for the contour plot
contour(app.UIAxes,ImgOut(:,:,round(Planes/2)),[TH,TH],'LineColor','white')
  3 Kommentare
Cris LaPierre
Cris LaPierre am 30 Mai 2020
I'm not testing this, but you do say the code at the top worked in a script, right? Try adding this hold command immediately before adding the contour plot.
hold(app.UIAxes,'on')
Scott Chegwidden
Scott Chegwidden am 30 Mai 2020
This works! Guess I just needed the right hold syntax. Thanks!!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by