Select a rectangle in a image.
Ältere Kommentare anzeigen
I have a image displayed in a imscrollpanel or figure. and I have a few rectangle drawn on top of it the facecolor is none. I have a ButtonDownFcn associated to each of these rectangles. I have something like:
ax = axes;
imshow(Image, [])
rectangle('parent', ax,...
'position', [20 20 100 100],...
'EdgeColor', 'r',...
'ButtonDownFcn', @(~,~)(disp('rectangle was selected.')))
The above code works but I need to click right on the edge of rectangle to make it work. My question is is there any smart way so that I can select rectangle by clicking inside rectangle? I could choose a face color to make it work but then I cannot see the image. So that does not help.
Thanks in advance
Antworten (2)
Azzi Abdelmalek
am 9 Aug. 2013
0 Stimmen
Maybe you are looking for imrect function
1 Kommentar
Sunil Shahi
am 9 Aug. 2013
Image Analyst
am 10 Aug. 2013
0 Stimmen
How about ginput(1)?
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!