How do I display the binary mask of a polygon ROI that was selected in an axis containing overlayed images?
9 次查看(过去 30 天)
显示 更早的评论
I am working with an overlayed image, where I've turned the transparency down. I would like to set a polygon ROI and display the binary mask of the ROI for the image. However, because there are multiple images in the axis, the function is throwing me an error:
"Error using images.roi.internal.mixin.CreateMask/validateInputs
Ambiguous syntax. Associated axes contains more than one image. Specify image handle as input argument to resolve ambiguity.
Error in images.roi.internal.mixin.CreateMask/createMask"
It seems like this wasn't a problem in previous versions since you could specify the image handle. Is there some way to access the roi of the different image in the Polygon object? (Matlab R2020a)
Here's some example code of what I'm trying to do:
I1 = imread('cell.tif');
I2 = imread('cameraman.tif');
im1 = imshow(I1,[]); hold on;
im2 = imshow(I2,[]);
set(im2, 'AlphaData', 0.6)
roi = drawpolygon(gca);
bw = roi.createMask;
0 个评论
采纳的回答
Jyotsna Talluri
2020-3-31
If there are multiple images on the axis , you have to specify the image handle as a input argument to the createMask function
bw = roi.createMask(im2);
This works fine in the latest version R2020a of MATLAB also
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!