Home > GVSToolbox > mixRGBAndGray.m

mixRGBAndGray

PURPOSE ^

returns an image which is a mixture of an RGB image and a grayscale image

SYNOPSIS ^

function mixedImage = mixRGBAndGray( oriImage, grayImage )

DESCRIPTION ^

 returns an image which is a mixture of an RGB image and a grayscale image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Tue 01-Jul-2014 12:35:04 by m2html © 2005