Selecting a row of image pixels as ROI from GUI

2 次查看(过去 30 天)
Hello,
Does anyone know of a way to use GUIDE to allow a user to select a 1-dimensional row (vector) of pixels in an image as a region of interest (i.e. the straight edge of an object)? I have an edge detected (logical) version of the colour image, and want to use the user's selection to find the closest edge coordinates that correspond to that image.
Many thanks in advance for any help you can throw my way.

采纳的回答

Paulo Silva
Paulo Silva 2011-2-27
Make a GUI with pushbutton and axis
Display the image on that axis
The button callback will be something like this
[x,y,button]=ginput(number)
This will allow you to get the coordinates of the pixels, x is a vector with the vertical positions and y is a vector with the horizontal positions, number is the number of points you let the user mark on the picture.
If you want the user to decide how many points he wants do something like this
button=1;xx=[];yy=[];
while button==1
[x,y,button]=ginput(1);
plot(x,y,'rx') %mark the point
if button==1
xx=[xx x];yy=[yy y];
end
end
This will save the points the user selected into xx and yy vectors until the user presses another button than 1 (left mouse button on my system)
  5 个评论
Paulo Silva
Paulo Silva 2011-2-27
The Pan function will also be very useful
You might also want to insert another button to initialize the figure (load it again into the axis), kind of GUI reset.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by