MATLAB: How we can merge mask on RGB image

image analysisimage processingImage Processing ToolboxMATLAB

Suppose I am having original image '1.jpg'- dimensions (605x700x3 uint8) and mask image 'D'-dimensions (255×255 unit 8). How do I showcase mask image on original image?

Best Answer

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));