match colors

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

match colors

Paweł Łabno
how can adjust color of a whole image so that selection color becomes an
eyedropped color?


https://drive.google.com/file/d/0ByRgd8_Fg3Fkc21QZVYzRTdpU0U/view?usp=sharing

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: match colors

Kenneth Sloan-2
First, you need some sort of model that deals with “how color spaces transform”.  This can range from the exceedingly simple-minded to the exceedingly complex.  The important thing is that you have some model, with a few parameters, that allows you to transform *all* the colors in the image in a principled way.  In other words, define the “dials” that you can twist.

Second, you take the current color (somewhere) and the desired color - and (somehow) determine the parameters of a transformation that maps one to the other.  If you are lucky, there is only one such mapping.  But, there might be more than one way to do it - in which case you have to select one (how?)

Finally, you apply the transformation to all the colors in the image.  For an 8-bit image, this can simply be a change of LookUp Table (LUT).  For a full 32-bit RGB image, you need a piece of code that iterates over all pixels and applies the transformation.

Here’s a really simple-minded way (for illustration - not actually recommended).

a) call the original color <oR, oG, oB> and the desired color <dR, dG, dB>
b) a transformation that works is R’ = R + (dR - oR), G’…, B’…
c) complication - what will you do when the computed R, G, or B is outside [0,255]?
   there are many choices - the simplest is to clamp:
    if (R < 0) R = 0; if (R > 255) R = 255; … …

Again - if your original image is an 8-bit image interpreted by a LUT, you do this computation for every color in the LUT and use the new LUT.  If not, you apply the transformation to every pixel.

I doubt that there is a plugin to do this - so you will need to roll your own Java code.

Note that the simple example assumes that your “design handles” are R,G,B.  It has the “advantage” that the transformation is a simple translation in RGB space.  Better might be Intensity, Hue, Saturation.  Or, Brightness, Contrast, and HueShift…or some such.  Ask 10 people working in color and you can get 15 answers.  Do you want the transformation to be linear?  to preserve Intensity?  to guarantee that your transformed gamut fits?

You might look at photo manipulation tools like Photoshop, or iPhoto, or Aperture, or Lightbox, to get a feel for the dials that people twist to “correct” colors in their images.  These tools often include just the operation you are asking for (usually with some limitation).  For example, nearly every tool allows you to select  color and make it “gray”, or make it “skin tone” - while bringing the rest of the colors along for the ride.  Another set of controls allows you to manipulate Brightness, Contrast, and Saturation.  Yet another allows you to manipulate “color temperature”.  All of these are different!

Only you can decide what flavor of transformation you want.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.




> On Jul 11, 2015, at 03:36 , Paweł Łabno <[hidden email]> wrote:
>
> how can adjust color of a whole image so that selection color becomes an
> eyedropped color?
>
>
> https://drive.google.com/file/d/0ByRgd8_Fg3Fkc21QZVYzRTdpU0U/view?usp=sharing
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: match colors

Paweł Łabno
I can match the colors in photoshop by eyedropping color to be replaced (A)
with shade color visible on the photo ex. A3 (B) by adjusting the curves
but photoshop experts say that it ruins the precision (opening RAW/NEF in
16 bits Lab color mode, adjusting curves , saving to TIFF in RGB, even with
16 bits, ProPhoto RGB). that's why i'd like to know if something similar is
possible in imagej?
1)eyedrop first color and read it's RGB/Lab values
2)eyedrop second color and read it's RGB/Lab values
3)adjust curves like in photoshop


and after I match colors i'd like to create such map with labels. is there
any plugin for that? or how should I do that?

thanks in advance
Paul

[image: Inline images 1]

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

shade_analysis-finemap.jpg (45K) Download Attachment