MATLAB: Is it possible to create an interactive / editable 2D rectangle or polygon without additional toolboxes

interactive graphics object; rectanlge; polygonMATLAB

Hi all, I am trying to create a simple GUI which allows the user to draw shapes (rectanges / polygons) over an image. Drawing the shape is easy enough however I am battling to make them editable. From searching the net it appears that this is very easy to do if you have the image processing toolbox. I can't justify purchasing the whole toolbox just for this so I'm curious as to whether or not there is a simple alternative. I am not an advanced programmer but I am comfortable with callback function basics and keen to improve.
Perhaps there are some examples of this out there already?
Thank you, Tyron

Best Answer

You can use rbbox(). It's not in any toolbox - it's in base MATLAB. Since it doesn't have little handles to drag around and doesn't require clicks to finish and ask for confirmation, after the user draws the box you just ask them if it's okay or if they want to redraw it. This will do a rectangle. Or you can use dragrect().
There is nothing like impoly() that's in base MATLAB that I know of.