Using 'getrect' on the main design window - App Designer

5 visualizaciones (últimos 30 días)
Salad Box
Salad Box el 23 de Nov. de 2021
Respondida: Cris LaPierre el 29 de Dic. de 2021
Hi
Below is my main design window. As you can see, within the blue box it is an Image Object, not an Axes Object. There is no axes objects used in this design.
When I press the top button 'load your image', a single colour image will appear on the left as below.
What I would like to achieve:
At this stage I would like the mouse to change to a little cross automatically and ready to grab an area within this design window (not to open a new figure).
How to apply 'get rect' this this case and where to put the code?
At the moment, below is where and how I try to write the 'getrect'. Clearly something went wrong there which I don't fully understand. :(
Also, the image has its ImageClick Callback. But guess I never want to click on the image so guess this shouldn't apply?
Can anyone please advise?
Many thanks.:)

Respuestas (1)

Cris LaPierre
Cris LaPierre el 29 de Dic. de 2021
The getrect and recommended drawrectangle function only work with axes objects. The workaround may be to add an axes, and then display the image using imshow (or other appropriate image display function) after loading it using imread.
Note the following about drawrectangle in App Designer:
Using ROIs in Apps Created with App Designer
You can use ROIs in apps created with App Designer, parenting an ROI in a UIAxes. You must explicitly specify the UIAxes when calling the ROI creation function, as an input argument or using the 'Parent' name/value pair. There are a few limitations when using ROIs in apps in this way:
  • The mouse cursor does not update when you hover over the ROI. The cursor is always an arrow.
  • The ROI does not change color when you hover over it.
  • The ROI right-click menu (UIContextMenu) is not supported.

Community Treasure Hunt

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

Start Hunting!

Translated by