returns an image which is a mixture of an RGB image and a grayscale image
0001 % returns an image which is a mixture of an RGB image and a grayscale image 0002 0003 function mixedImage = mixRGBAndGray( oriImage, grayImage ) 0004 grayScalar = .5*255./max(max(grayImage)); 0005 0006 if length(size( oriImage ))==2 %if grayscale 0007 mixedImage = .3.*oriImage + uint8(grayScalar.*grayImage); 0008 else % its color 0009 mixedImage = .5.*oriImage + repmat(uint8(grayScalar.*grayImage), [1,1,3]); 0010 end 0011