How to fill color in the specified area?

 Accepted Answer

You can use imfill() if you have a binary image, or if the binary image is a mask, then for a black and white image, you can do
grayImage(binaryImage) = fillColor; % Whatever this might be, say 42 or 123.
If you have a color image, you can do
% Mask the image.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask,class(rgbImage)));

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!