How can I create a mask using multiple ROI?
Show older comments

I have measured the size of mushrooms in an image. Now I want to create a mask using multiple ROI. I use the mask=createMask(h) command, but I can only draw one circle. Is there a way to make all those circles into a mask?
load('CircleData.mat');
for img = 35:10:55
bw_img = zeros(400,400);
figure; imshow(bw_img);
x = xcoor(:,1);
y = ycoor(:,1);
r = Radii(:,1);
x = x(any(~isnan(x),2),:);
y = y(any(~isnan(y),2),:);
r = r(any(~isnan(r),2),:);
len = length(r);
mask = {1:len};
for count = 1:1:len
h = drawellipse('Center',[x(count) y(count)],'SemiAxes',[r(count) r(count)]);
mask = createMask(h)
imshow(mask);
end
end
Accepted Answer
More Answers (0)
Categories
Find more on ROI-Based Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!