matlab - Use more points to define imroi object -
in short: wondering if possible, when using roi base classes (imroi actually) such impoly, imfreehand , others increase number of points (i.e. increase sensitivity) generated getposition method.
sample code:
consider following code, in i:
1) read , display image
2) call imfreehand
draw closed region of interest.
3) call getposition
nx2 array in coordinates defining freehand object draw stored.
4) call scatter
see actual coordinates recorded.
clear clc close %// read , display image = imread('coins.png'); imshow(a) %// set imroi object hroi = imfreehand(gca,'closed',1); %// position nx2 array roiposition = getposition(hroi); %// display points retrieved getposition method. hold on scatter(roiposition(:,1),roiposition(:,2),20,'r','filled')
after zooming on roi drawn, this:
which 1 can see lack couple points describe object.
to put in other words, possible obtain nx2 array getposition
method n larger default (whose value don't know)? searched on web couldn't find relating issue.
thanks!
if not late, there alternative method coordinates using bwboundaries()
on mask of roi object hroi
created.
here example :
a = imread('coins.png'); imshow(a) hroi = imfreehand(gca, 'closed', 1); bw = createmask(hroi); b = bwboundaries(bw); b = b{:}; hold on scatter(b(:,2), b(:,1),20, 'r', 'filled')
Comments
Post a Comment