Error when using createMask

7 次查看(过去 30 天)
Manuel Matus
Manuel Matus 2019-4-12
回答: Brian Hart 2019-4-12
I am trying to develop a code in which I want to modify a figure. However, when I call createMask, I get an error saying "Undifined function or variable 'createMask'.
This is the code:
% read the original image
I = imread('TEST.PNG');
% call createMask function to get the mask and the filtered image
[BW,maskedRGBImage] = createMask(I);
% plot the original image, mask and filtered image all in one figure
subplot(1,3,1);imshow(I);title('Original Image');
subplot(1,3,2);imshow(BW);title('Mask');
subplot(1,3,3);imshow(maskedRGBImage);title('Filtered Image');
Any suggestions?

回答(1 个)

Brian Hart
Brian Hart 2019-4-12
Hi Manuel,
A mask is created from an ROI (region of interest), not an image. First you need to create an ROI with drawellipse, drawfreehand, etc. Then you can create a binary mask.
See the documentation for createMask for a good example.

标签

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by