Login  Register

Re: Substract diffuse reflection.... #2

Posted by Kenneth Sloan-2 on Oct 25, 2006; 11:29pm
URL: http://imagej.273.s1.nabble.com/Substract-diffuse-reflection-tp3701147p3701150.html

On Oct 25, 2006, at 3:24 PM, Liisa Palomaa wrote:

> Hi..
>
> Thanks, but it didn't work. If I first use smooth and then substract
> the smoothed image from the original- I end up with a black
> image......
>
> //Liisa

My version of Unsharp Masking (which is, I think, what you are trying  
to do),
computes a weighted average of the original and the smoothed image:

Result = a*Original + b*Smoothed;   /* a + b = 1.0 */

or, more explicitly:

Result = a*Original + (1.0-a)*Smoothed;

This gives you a complete family of possible results, as you vary a.
Finally, be sure to clip the Result against 0.0 and 1.0, to avoid  
solarization
effects (or...not, if you like them - but I suspect you won't like  
them).

If your implementation looks like:

Result = Original - Smoothed;

then you will, indeed, get a very dark image.  for your application, you
should start with:

Result = 2.0*Original - 1.0*Smoothed;

and then explore from there.

For extra credit only:  instead of clipping against 0.0 and 1.0, you  
might
instead think about shrinking the range of Result values around 0.5  
if the
range of Results is too big (or expanding about 0.5 if the range is  
too narrow).
But, in my experiece, clipping is adequate.

--
Kenneth Sloan                                [hidden email]
Computer and Information Sciences                    +1-205-934-2213
University of Alabama at Birmingham              FAX +1-205-934-5473
Birmingham, AL 35294-1170              http://www.cis.uab.edu/sloan/