Error when using createMask

4 views (last 30 days)
Manuel Matus
Manuel Matus on 12 Apr 2019
Answered: Brian Hart on 12 Apr 2019
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?

Answers (1)

Brian Hart
Brian Hart on 12 Apr 2019
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.

Tags

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!