adjust color

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

adjust color

Paweł Łabno
my selection is for example rgb 185,115, 64
i'd like whole image to adjust so this selection becomes rgb (160, 105,120)

how can i do that?

best regards
Paul

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

Re: adjust color

Michael Schmid
On Jul 23, 2015, at 12:31, Paweł Łabno wrote:

> my selection is for example rgb 185,115, 64
> i'd like whole image to adjust so this selection becomes rgb (160, 105,120)
> how can i do that?

Hi Pawel,

there was already a reply to a recent mail of yours on the same subject:
  https://list.nih.gov/cgi-bin/wa.exe?A2=ind1507&L=IMAGEJ&F=&S=&P=88920

It really depends a lot on how you want to adjust the image:

(1) If the white balance of the camera or the illumination has changed, an approximate way would be multiplying each pixel with an appropriate value.
(2) If the background is not black any more, e.g. due to stray light, you have to subtract the 'black' pixel values from all pixels.  Not that this works only if the response of the camera is linear.  If your camera creates a JPG file, you can be sure that it is nonlinear (e.g. sRGB) and you must not add to or subtract values to get a meaningful result.
  https://en.wikipedia.org/wiki/SRGB
  https://en.wikipedia.org/wiki/Gamma_correction

Assuming (1), convert your image to an RGB stack; multiply each channel by a suitable value (e.g. channel R should be multiplied by 160/185 = 0.86486) and convert it back to RGB.

Probably you will want to have a macro for it.  If you do it manually and have the Macro Recorder active (Plugins>Macros>Record), you will find all commands except for the setSlice() command used to switch between the R, G, B channels.
  http://rsb.info.nih.gov/ij/developer/macro/functions.html#setSlice

Have a look at these pages for macro programming
  http://rsb.info.nih.gov/ij/developer/macro/macros.html
  http://rsb.info.nih.gov/ij/developer/macro/functions.html
  http://fiji.sc/Introduction_into_Macro_Programming


Michael

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