This question has two parts.
First I want to draw a rectangle on an image in gui only when the mouse hovers on the image. Secondly, if the user clicks the image execute some statements. Right now, I can only draw the rectangle on the image in following manner,
axes(handles.axes1);[r,c,~]=size(Image);rectangle('Position', [-2,-2,c+4,r+4],'EdgeColor','r');
Best Answer