MATLAB: How can i change the color of an image with another image

backgroundimage processing

I have two images. The first is the image that i want to show, and the other is the backgroud. I want to project an image that an operation with the output image and the backgroud image makes the input image. Any idea? Thanks!

Best Answer

If you want to do histogram matching, this is the best algorithm out there that I know of: http://www.eyemaginary.com/Portfolio/ColorHistogramWarp.html
Otherwise you may simply want to convert to hsv color space and just replace the h and s channels
hsv1 = rgb2hsv(rggImage1);
h1 = hsv1(:,:,1);
s1 = hsv1(:,:,2);
v1 = hsv1(:,:,3);
hsv2 = rgb2hsv(rggImage2);
h2 = hsv2(:,:,1);
s2 = hsv2(:,:,2);
v2 = hsv2(:,:,3);
newHSVImage = cat(3, h2, s2, v1);
newRGB = uint8(hsv2rgb(newHSVImage));