MATLAB: Overlay binary image image on contrast stretched image to get the final result

functionImage Processing Toolboxoverlayimage

I have to create a function which should take as input the contrast stretched image and the refined binary mask. The output should be the overlay image.Can anyone help?

Best Answer

Try imoverlay:
% Read in image.
grayImage = imread('cameraman.tif');
% Read a binary image into the workspace.
BW = imread('text.png');
% Burn the binary image into the grayscale image, specifying the color to be used for the binary mask.
rgbImage = imoverlay(grayImage, BW, 'yellow');
% Display the result.
imshow(rgbImage)
Related Question