Select a rectangle in a image.

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

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 9일

0 개 추천

Maybe you are looking for imrect function

댓글 수: 1

Sunil  Shahi
Sunil Shahi 2013년 8월 9일
I already looked into imrect function. I do not want to change the position of rectangle. I just want to select them more convinently.. so imrect does not work either

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2013년 8월 10일

0 개 추천

How about ginput(1)?

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

질문:

2013년 8월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by