Matching Colors of Source Image to Target Image
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi. I want to match colors of source image to target image.
Source and reference images are identical with same resolution, aside from the color. (Actually, target image is a graded version of source image)
Here is the source image:

Here is the target image:

So far what I did is:
- -Converted source and target images to LAB color space
Now, I'm not sure how to proceed from here.
- -Shall I go with histogram matching in LAB (not sure how to do it)
- -Calculate deltaE between each pixel, calculate mean etc (also not sure how to do it)
- -Use any other Color Space such as LCH
Please help me regarding this...
2 commentaires
Walter Roberson
le 26 Avr 2018
What do you mean by matching colors in this case? Are you looking for a linear transform in rgb, or in LAB? Looking for a curve of hue correction? A look up table of original and target colours?
Is it assumed that any given source color is always matched to the same target color?
Réponse acceptée
Walter Roberson
le 27 Avr 2018
[old_colors, old_idx] = unique(reshape(Original_Image, [], 3), 'rows');
reshaped_new = reshape(New_Image, [], 3);
new_colors = reshaped_new(old_idx, :);
The lookup table is then that each row of old_colors is matched to the corresponding row of new_colors .
This assumes that any given source color is always matched to the same target color.
4 commentaires
Walter Roberson
le 27 Avr 2018
Yes.
Note: rgb2lab() always produces double even for uint8 source, and lab2rgb() of that will produce double, with the round trip being equivalent to im2double(). Also I notice that the result of lab2rgb can be slightly negative due to round-off error such as for (0,242,65). However, if you im2uint8() the result of the round trip, then that will be identical to the original RGB.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Convert Image Type dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!