How we can merge mask on RGB image
3 次查看(过去 30 天)
显示 更早的评论
Suppose I am having original image '1.jpg'- dimensions (605x700x3 uint8) and mask image 'D'-dimensions (255x255 unit 8). How do I showcase mask image on original image?
0 个评论
采纳的回答
Image Analyst
2018-5-24
I don't know what "showcase" means to you, but maybe you mean to mask the RGB image with the binary image. If so, do this:
% Mask the image using bsxfun() function to multiply the mask by each channel individually.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));
1 个评论
Image Analyst
2018-5-24
Or maybe you want to overlay the mask in a tinted color over the image:
更多回答(1 个)
sakshi ahuja
2018-5-24
1 个评论
Image Analyst
2018-5-24
D must be a 2-D logical image. img must be a 3-D RGB full color image. They both must have the same number of rows and columns. What does this show in the command window:
[rowsD, colsD, colorsD] = size(D) % No semicolon!
[rowsi, colsi, colorsi] = size(img) % No semicolon!
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!