Select region of interest and create a mask from it
imout = imroi(imin [, nr_points ]) imout = imroi(imin [, points ])
Input Image
Maximum number of points to select with mouse - a positive integer (the default value is 10)
a 2xN matrix of points; if present the region is defined by points and no interactive mouse selection is used
Output mask
The first calling sequence is used to provide interactive way to select up to nr_points points (or up to 10 points, if nr_points is not given) by using right mouse button to select the last point, and points are used to create the image mask.
The second calling sequence is used to create a mask from a region defined by a Nx2 matrix points which has the form [x1,y1;x2,y2;...;xN,yN], where (xi,yi), i=1..N are vertices of the region.
S = imread(fullpath(getIPCVpath() + "/images/balloons.png")); imout = imroi(S); // interactive selection of a region (max 10 vertices) imout = imroi(S,15); // interactive selection of a region (max 15 vertices) imout = imroi(S,[10,10;20 20;15 35]); // create a mask from a region defined by points imshow(imout); | ![]() | ![]() |