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} |
On Wednesday 17 Mar 2010 11:27:27 you wrote:
> 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. Thanks. Can you provide a working plugin? I cannot make the MSRCR routine work (I added the missing s_log function, but I get a black image as result). Cheers G. |
In reply to this post by Samuel Verhaegen
Further to my previous message I made it work (well kind off).
I get some output if I tweak the variables: > G=192, b=-30, alpha=125, Beta=45 but the output is nowhere near what one sees on the original retinex papers or in the Gimp. I wonder if some clipping of the r,g,b results is necessary, but I had no time to check. Cheers G. |
In reply to this post by Samuel Verhaegen
Thanks Dr. Landini for your feedback and observations. Sorry for the
difficulties with the parameters! I am also unable to reproduce the spectacular results found in the paper and elsewhere. Hopefully, we are on the right track with the algorithm logic and only need to tweak the parameters better but I am not very confident of this yet. If I understand correctly, you raise the issue of clipping the r,g,b values (is this synonymous with clamping?). The reason I use a float array for calculations is that I wanted to avoid problems with 'clamping' to the range of [0,1,...,255] because I was afraid there may be a loss of visual information during intermediate steps. Nevertheless, if clamping is necessary or useful, it would be great then to use the native ImageJ methods such as log() or add() since they are more efficient. Where to go from here: *Try to rule out errors in the implementation itself i.e. mis-casting. *Acquire some better non-lossy test images. The authors of the papers mention that lossy jpeg images cause problems. *Put together a parameter control dialog to facilitate testing. Maybe some kind of script to automate comparing the different values? *Obtain and write better descriptions of the parameters to make the algorithm easier to use and understand for better results. *Investigate 'clipping' for r,g,b values. *Maybe try different techniques. While the basic retinex equation is uncontroversial, different authors have reported different methods of color restoration that may be simpler and more effective. Unfortunately, I am away from my own computer this week. Anyway, I can also do some more testing next week of the other versions of retinex that I wrote based on translated C++/OpenCV code and see if they work better. Best, Sam |
On Thursday 18 Mar 2010 11:12:40 you wrote:
> If I understand correctly, you raise the issue of clipping the r,g,b values > (is this synonymous with clamping?). The reason I use a float array for > calculations is that I wanted to avoid problems with 'clamping' to the > range of [0,1,...,255] because I was afraid there may be a loss of visual > information during intermediate steps. Nevertheless, if clamping is > necessary or useful, it would be great then to use the native ImageJ > methods such as log() or add() since they are more efficient. Yes, I meant clamping. Not sure if that is the source of the problem, it was just a guess. Cheers, G. |
In reply to this post by Samuel Verhaegen
Hai Mr...
I want to ask , how the stages of the algorithm MSRCR ?if possible with flowchart please help me |
In reply to this post by Samuel Verhaegen
I want to ask , how the stages of the algorithm MSRCR ?
along with his flowcart and formulas of MSRCR |
Free forum by Nabble | Edit this page |