How to retrieval back the color in particular area from original image?
Show older comments

13100.jpg
colorImage = imread('13100.jpg');
grayImage = rgb2gray(colorImage);
mserRegions = detectMSERFeatures(grayImage);
mserRegionsPixels = vertcat(cell2mat(mserRegions.PixelList));
mserMask = false(size(grayImage));
ind = sub2ind(size(mserMask), mserRegionsPixels(:,2), mserRegionsPixels(:,1));
mserMask(ind) = true;
figure;imshow(mserMask);

MSER mask
How to retrieve back the original color from 13100.jpg and paste into MSER mask (white area)?
Accepted Answer
More Answers (1)
Image Analyst
on 17 Mar 2017
Try bsxfun():
% Mask the image using bsxfun() function
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
1 Comment
Mei Synn Tan
on 18 Mar 2017
Edited: Mei Synn Tan
on 18 Mar 2017
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!