开发者

Histogram matching of two colored images in matlab

开发者 https://www.devze.com 2023-03-13 05:21 出处:网络
Anyone knows how to perform RGB histogram matching on two colored images? for example this is an image to be re-mapped:

Anyone knows how to perform RGB histogram matching on two colored images?

for example this is an image to be re-mapped:

Histogram matching of two colored images in matlab

and this is a target image

Histogram matching of two colored images in matlab

Then the RGB remapped image look like this

Histogram matching of two colored images in matlab

here is what I did so far, in this code I took two color images im1 and im2

I took the im1 which is the one that has to be remapped then broke it up into

its colors then I took each color of im1 and used histeq to match their histograms to

each color in im2.

I don't know how to reconstruct the re-mapped image from the colors I matched, any help please that would be nice??:

im1 = imread('Atlas-Mer.png');
im2 = imread('techno-trs.png');

Red1 = im1(:, :, 1);
Green1 = im1(:, :, 2);
Blue1 = im1(:, :, 3);
.
.
.
Red2 = im2(:, :, 1);
Green2 = im2(:, :, 2);
Blue2 = im2(:, :, 3);

red2n = histeq(Re开发者_StackOverflow中文版d2,HnRed1);
green2n = histeq(Green2,HnGreen1);
blue2n = histeq(Blue2,HnBlue1);


Well it's been months since the original question was posted but I think everyone can use an alternative approach to what was suggested: the following code puts the three color channels into one RGB image:

rgb_out = cat(3, red2n, green2n, blue2n);


You can just do:

im2(:, :, 1) = red2n;

etc.


Matlab now has a built-in function in the Image Processing Toolbox to do this: http://www.mathworks.com/help/images/ref/imhistmatch.html

But if you have an older version of Matlab (I have 2010b and it does not include imhistmatch.m), this is function that does classic histogram matching: https://www.mathworks.com/matlabcentral/fileexchange/27396-matchhistograms

0

精彩评论

暂无评论...
验证码 换一张
取 消