Login  Register

Retinex Plug-in

Posted by Samuel Verhaegen on Mar 17, 2010; 6:57am
URL: http://imagej.273.s1.nabble.com/Retinex-Plug-in-tp3688904.html

Hi all,

I've been working on an implementation of the Multi-Scale Retinex algorithms
(with/without Color Restoration) since they are not available in ImageJ. So
far, I have a rough-draft version for RGB images based on one of the papers
by Mr. Jobson and Dr. Rahman.

I am a newbie when it comes to ImageJ and am currently an undergraduate
student, so I don't have a whole lot of experience. Nevertheless, since the
MSR algorithms haven't been implemented for ImageJ yet, hopefully this will
be a forward step or at least a starting point. If anyone is interested
enough to offer help or critiques, my work-in-progress is here: (1: MSR
method) http://pastie.org/private/4fau24xyaxn8iju9szm5qw , and (2: MSRCR
method) http://pastie.org/private/aaizkwvduqae5hquq9tca .

Some inspiration comes from looking at these C++/OpenCV based
implementations: (1) http://www.stat.ucla.edu/~wzhu/downloads/codes.html , and
(2) http://people.ucsc.edu/~dgray/ . I have translated these versions into
Java/ImageJ but I am not completely satisfied with the results so I have
opted to start from scratch instead.

This is my first foray into the world of open-source so I apologize in
advance for any errors or misunderstandings that I have
undoubtedly committed. Also, if any of the authors of "Digital Image
Processing", Wilhelm Burger or Mark Burge, are reading this, let me say
thanks! The book is very enjoyable so far.

Best,
Sam Verhaegen

p.s. Here is some background information based on my understanding of the
MultiScale Center/Surround Retinex by Dobson and Rahman:
A single-scale retinex for the i'th color channel is given by R_i(x,y) =
log( Image_i(x,y)) - log( F(x,y) * I_i(x,y))  where the * denotes the
convolution operator and F(x,y) is the Gaussian surround function (which is
equivalent to applying a Gaussian blur on the image it seems).

A multi-scale retinex is simply the sum of several SSR outputs that have
been scaled differently by N scales (typically N=3).
So then RMSR_i = SUM_from n=1_to_N( weight[n] * R_i[n] )
(note: in this part, as well as the subsequent parts, the * operator denotes
multiplication.)

The MSRCR algorithm has an additional color restoration step using a
function C(x,y) so that RMSRCR_i(x,y) = C_i(x,y)*RMSR_i(x,y)
The color restoration function is: C_i(x,y)= Beta*{log(alpha*Image_i(x,y) )
- log(SUM_from_i=1_to_3( Image_i(x,y) )}  where Beta is a gain constant and
alpha is the strength of the nonlinearity of color restoration.

Afterwards, the modified image takes on a gain=G/offset=b adjustment. So,
overall, the MSRCR can be described as:
RMSRCR_i(x,y) = G[C_i(x,y) *{log( Image_i(x,y)) - log( F(x,y) * I_i(x,y)) }
+ b ]

Some suggested values for the constants are: N=3, sigmas={15,80,250}, G=192,
b=-30, alpha=125, Beta=45, weights={.33,.33,.33}