Re: best fit linear filter
- From: hoffmann@xxxxxxxxxxxx
- Date: Sun, 27 Jul 2008 10:27:28 -0700 (PDT)
DharmaFog schrieb:
On Jul 26, 12:34 am, ti_chris <tiChri...@xxxxxxxxx> wrote:
On Jul 24, 7:11 pm, DharmaFog <Agile.Asp...@xxxxxxxxx> wrote:
On Jul 22, 12:18 pm, "Fredo" <fr...@xxxxxxxxxxx> wrote:
I have an image that I need to normalize the brightness on. The image is
greyscale 8-bit. I'm told I need to do a best fit linear filter. How do I do
this? Is this just a linear regression? If so, I need X&Y values and I'm not
sure what should be X vs. what should be Y. I assume one of them is the
pixel brightness. What's the other?
Thanks
It's actually an exercise in simple ratios.
First find the maximum and minimum gray scale for the
image you want to normalize, i.e., the range of the existing
values.
Suppose you want to normalize the values to N=255.
Then
new_value=(old_value-minimum)*N/(maximum-minimum)
Although this can generate decent results, it is definitely not
ideal. Take the example of an image that has a concentration of
middle-range pixels and one or two pixels at the boundaries. In such
a case, you would not scale the image because min = 0, max = 255,
while in reality, you would benefit from over-saturating those couple
pixels that are out of range. Fredo is right. You need to apply a
best-fit to achieve good results here.
I'm guessing you're really looking to do a linear regression. You can
find lots of resources if you google for that. A simple one is
wikipedia:
http://en.wikipedia.org/wiki/Linear_regression
You're effectively looking at applying least square on the difference
between the "new value" and the "old value" given a line y = mx + b.
Least square should minimize things decently enough that it should
look much better than what DharmaFog is proposing. If you want a
quick and dirty thing that works however, his suggestion is quite
valid.
First, normalization implies scaling - it's doesn't imply molesting
the histogram distribution.
Second, I really don't know what a "best fit linear filter"
is since "best" hasn't been defined.
And if was defined, then I'd probably filter the image using
a FIR filter.
Third, in your particular case - where you evidently want
to modify the existing histogram distribution - I would
recommend trying histogram equalization
http://en.wikipedia.org/wiki/Histogram_equalization
But beware, when you use histogram equalization (or any
other method which molests the distribution) you run the risk
of increasing the noise and decreasing the signal.
Meanwhile, the OP seems to believe that his 'normalization'
is nicely executed by a high pass filter (without mentioning the
necessary offset):
http://groups.google.de/group/sci.image.processing/browse_frm/thread/3512a979fb60707d#
Best regards --Gernot Hoffmann
.
- Follow-Ups:
- Re: best fit linear filter
- From: ti_chris
- Re: best fit linear filter
- References:
- best fit linear filter
- From: Fredo
- Re: best fit linear filter
- From: DharmaFog
- Re: best fit linear filter
- From: ti_chris
- Re: best fit linear filter
- From: DharmaFog
- best fit linear filter
- Prev by Date: Moment of Inertia for 2D Shapes
- Next by Date: Re: Terrain Generator design decision
- Previous by thread: Re: best fit linear filter
- Next by thread: Re: best fit linear filter
- Index(es):
Relevant Pages
|