DSPRelated.com
Forums

FFTW, Imlib & OpenCV

Started by sunderam June 18, 2005
] Suppose and are two nonnegative image signals,

OK, we have two images:

I1(x,y,p)

and

I2(x,y,p)

that have non-negative (i.e. 0 or greater) values.  I'd suggest this is
usually integers in the range 0 to 255 inclusive.

] which have been aligned
] with each other (e.g.,spatial patches extracted from each image).

OK, so there's been some movement between I1 and I2:

I1(x,y,p) ~= I2(x-x0,y-y0,p)

if there is just translation, or a more complex relationship between
(x,y) in one image and (x,y) in the other image if there is some
rotation, scale or shear (or combination of all four: translation,
rotation, scale and shear).

] If we
] consider one of the signals to have perfect quality, then the
] similarity measure can serve as a quantitative measurement of the
] quality of the second signal.

OK, so assume that I1 is "the truth".

] The system separates the task of similarity
] measurement into three comparisons: luminance, contrast and structure


Luminance:
========
I've been assuming that the planes of your image are red, green, blue
and alpha (transparency).  There are other ways to split the colour
(red,green,blue) planes: a common approach is Y, Cr, Cb.  "Y" is called
the luminance.  One possible way to get from (R,G,B) to Y is given in:

http://www.gimlay.org/~andoh/cg/faq/ColorFAQ.html#RTFToC9

YMMV.

Contrast (Ratio):
============

Check out Poynton's FAQ:

http://www.poynton.com/notes/colour_and_gamma/GammaFAQ.html#contrast_ratio

Structure:
========

This is not a well-defined term in image processing --- it depends on
what you're looking for.  It could mean "edges".  It could mean
"corners".  It could mean "regions of color".  It could mean "regions
of texture".  It could mean "texture".

Ciao,

Peter K.

> This is what i found in "Algorithms of image processing and computer Vision" By J R Parker.
> "The fourier transform breaks up an image(or, in one dimension, a signal) into set of sine and cosine components."
That is an accurate description. Contrast is a property of images, not of sinusoids. Note that the definition tells us that Fourier transforms operate on signals; they do not create them. The link you gave should be updated to http://homepages.inf.ed.ac.uk/rbf/HIPR2/. I didn't explore it. Jerry
Fourier transform are used to move between spatial and frequency domain.
This link uses image and calculates their fourier transform among other
things

http://homepages.inf.ed.ac.uk/rbf/HIPR2/fftdemo.htm

check this out -http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm

"The Fourier Transform is an important image processing tool which is used
to decompose an image into its sine and cosine components. The output of
the transformation represents the image in the Fourier or frequency
domain, while the input image is the spatial domain equivalent."

Sunderam

>> This is what i found in "Algorithms of image processing and computer
Vision" By J R Parker.
> >> "The fourier transform breaks up an image(or, in one dimension, a
signal) into set of sine and cosine components."
> >That is an accurate description. Contrast is a property of images, not >of sinusoids. Note that the definition tells us that Fourier transforms >operate on signals; they do not create them. > >The link you gave should be updated to >http://homepages.inf.ed.ac.uk/rbf/HIPR2/. I didn't explore it. > >Jerry > >
This message was sent using the Comp.DSP web interface on www.DSPRelated.com

sunderam wrote:
> Fourier transform are used to move between spatial and frequency domain. > This link uses image and calculates their fourier transform among other > things
Yes.
> http://homepages.inf.ed.ac.uk/rbf/HIPR2/fftdemo.htm > > check this out -http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm
I understand what the FT does. I'll pass on the links for now.
> "The Fourier Transform is an important image processing tool which is used > to decompose an image into its sine and cosine components. The output of > the transformation represents the image in the Fourier or frequency > domain, while the input image is the spatial domain equivalent."
True. FT is not useful for contrast and other spatial image properties. ... Jerry
I never said i was performing FT for calculating the contrast...Sorry if it
seemed that i meant to use FT for doing so.
 I need to get the signal repreesntation which intent to calculate the
intensity of the signal - lumninance(as suggested by the paper).
Secondly, i remove the mean intensity from the signal. And use std
deviation as an estimate of signal contrast.
Sunderam
> > >sunderam wrote: >> Fourier transform are used to move between spatial and frequency
domain.
>> This link uses image and calculates their fourier transform among
other
>> things > >Yes. > >> http://homepages.inf.ed.ac.uk/rbf/HIPR2/fftdemo.htm >> >> check this out -http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm > >I understand what the FT does. I'll pass on the links for now. > >> "The Fourier Transform is an important image processing tool which is
used
>> to decompose an image into its sine and cosine components. The output
of
>> the transformation represents the image in the Fourier or frequency >> domain, while the input image is the spatial domain equivalent." > >True. FT is not useful for contrast and other spatial image properties. > > ... > >Jerry > >
This message was sent using the Comp.DSP web interface on www.DSPRelated.com

sunderam wrote:
> I never said i was performing FT for calculating the contrast...Sorry if it > seemed that i meant to use FT for doing so. > I need to get the signal repreesntation which intent to calculate the > intensity of the signal - lumninance(as suggested by the paper). > Secondly, i remove the mean intensity from the signal. And use std > deviation as an estimate of signal contrast. > Sunderam > > > > > >sunderam wrote: > >> Fourier transform are used to move between spatial and frequency > domain. > >> This link uses image and calculates their fourier transform among > other > >> things > > > >Yes. > > > >> http://homepages.inf.ed.ac.uk/rbf/HIPR2/fftdemo.htm > >> > >> check this out -http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm > > > >I understand what the FT does. I'll pass on the links for now. > > > >> "The Fourier Transform is an important image processing tool which is > used > >> to decompose an image into its sine and cosine components. The output > of > >> the transformation represents the image in the Fourier or frequency > >> domain, while the input image is the spatial domain equivalent." > > > >True. FT is not useful for contrast and other spatial image properties.
FT is not particularly useful for calculating luminance or intensity, mean intensity, or standard deviation, either. All of those are spatial measures. What will you do with frequency distributions? Jerry
> > FT is not particularly useful for calculating luminance or intensity, > mean intensity, or standard deviation, either. All of those are spatial > measures. What will you do with frequency distributions? > > Jerry >
Hello Jerry, I believe he is asking about spatial frequency stuff. If I take a 2-D DFT of an image (assume B&W for now), then the frequency domain of the DFT refers to spatial frequency. I.e., Image a picture of a picket fence. The spatial frequency is x number of pickets per unit distance. Or in the discrete case one may use spatial period - i.e., number of pixels per cycle. When testing lenses, one images a test chart with patches that have have alternating black and white bars, where each patch's bars have a different spacing. When looking at a particular spatial frequency, one can calculate the contrast by comparing the DFT's value for the spatial frequency for the "picket fence" to the total spatial energy. Likewise, the sum of the squares of all of the DFT's outputs except the DC term gives the variance of the data set. (watch out for scaling by N^2) If an image has had the DC bias removed, then the variance is the spatial energy apart from the scaling by N^2. There are some programs out there that have you use a digital camera to take a picture of a standard test chart, and then, subsets of the image are used for DFT analyses to estimate the lens' properties. The "estimate" stems from the testing being of a lens-sensor combination. And one has to separate the sensor's properties from the lens' properties. Also if you recall Abbe's method of contrast enhancement for microscopy is a FT method. Of course he exploited an optical property to get his FT, but it is the basis of his image enhancement and his theory of image formation. He simply placed an opaque disk centered in the optical axis on the Fourier plane to block the DC component. He could change the diameter of this disk to effect a change of the cutoff of the spatial high pass filter. Neat! Clay
The FT of ima for this signal i would calc 
1.mean intensity
2.std deviation
Sunderam 
ge would give me a signal.
> > >sunderam wrote: >> I never said i was pe rforming FT for calculating the contrast...Sorry
if it
>> seemed that i meant to use FT for doing so. >> I need to get the signal repreesntation which intent to calculate the >> intensity of the signal - lumninance(as suggested by the paper). >> Secondly, i remove the mean intensity from the signal. And use std >> deviation as an estimate of signal contrast. >> Sunderam >> > >> > >> >sunderam wrote: >> >> Fourier transform are used to move between spatial and frequency >> domain. >> >> This link uses image and calculates their fourier transform among >> other >> >> things >> > >> >Yes. >> > >> >> http://homepages.inf.ed.ac.uk/rbf/HIPR2/fftdemo.htm >> >> >> >> check this out -http://homepages.inf.ed.ac.uk/rbf/HIPR2/fourier.htm >> > >> >I understand what the FT does. I'll pass on the links for now. >> > >> >> "The Fourier Transform is an important image processing tool which
is
>> used >> >> to decompose an image into its sine and cosine components. The
output
>> of >> >> the transformation represents the image in the Fourier or frequency >> >> domain, while the input image is the spatial domain equivalent." >> > >> >True. FT is not useful for contrast and other spatial image
properties.
> >FT is not particularly useful for calculating luminance or intensity, >mean intensity, or standard deviation, either. All of those are spatial >measures. What will you do with frequency distributions? > >Jerry > >
This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Clay S. Turner wrote:
> > > > FT is not particularly useful for calculating luminance or intensity, > > mean intensity, or standard deviation, either. All of those are spatial > > measures. What will you do with frequency distributions? > > > > Jerry > > > > Hello Jerry, > > I believe he is asking about spatial frequency stuff. If I take a 2-D DFT of > an image (assume B&W for now), then the frequency domain of the DFT refers > to spatial frequency. I.e., Image a picture of a picket fence. The spatial > frequency is x number of pickets per unit distance. Or in the discrete case > one may use spatial period - i.e., number of pixels per cycle. When testing > lenses, one images a test chart with patches that have have alternating > black and white bars, where each patch's bars have a different spacing. When > looking at a particular spatial frequency, one can calculate the contrast by > comparing the DFT's value for the spatial frequency for the "picket fence" > to the total spatial energy. Likewise, the sum of the squares of all of the > DFT's outputs except the DC term gives the variance of the data set. (watch > out for scaling by N^2) If an image has had the DC bias removed, then the > variance is the spatial energy apart from the scaling by N^2.
... Recall his statement, "I need to get the signal represntation which intent to calculate the intensity of the signal - lumninance(as suggested by the paper). Secondly, i remove the mean intensity from the signal. And use std deviation as an estimate of signal contrast." That seems to me to be related to coordinates rather than to frequencies. I don't like standard deviation as a measure of contrast; it depends too much on the image content. As an old darkroom hand, I prefer a measure that is more closely tied to the image _formation_ proces. Gamma is a useful measure not only with emulsions, but with video and digital images. I see other measures primarily as substitutes for gamma in circumstances where its evaluation is difficult or impossible. Jerry
sunderam wrote:
> The FT of ima for this signal i would calc > 1.mean intensity > 2.std deviation > Sunderam > ge would give me a signal.
Neither intensity nor its standard deviation is measured in the frequency domain. For that, you want not the FT, but the original signal. What is "ge"? Jerry