FFT Power Spectrum Question: RGB vs 8-bit stack

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

FFT Power Spectrum Question: RGB vs 8-bit stack

Jack Hogan
Hello folks,

Can any of you Imagej experts illuminate a noob as to why the FFT Power
Spectra of two image types of the exact same image look so different?
 Specifically, referring to the attached image, the top row is the 8bit RGB
rendition of a raw file with minimal demosaicing and its FFT.  The bottom
row is the same RGB 8 bit rendition but after having been 'stacked' through
Image/Color/MakeComposite and an FFT generated for each color slice.

How does Imagej's FFT algorithm combine the separate RGB channels to come
up with its power spectrum? And why is it so different from the individual
channels'?

Thank you for your help.

Jack

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

FFT RGB vs Individual Slices.jpg (241K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Herbie-3
Good day Jack,

the differences may appear big in the display but please note that the
Fourier-spectral values are scaled according to the logarithm which
emphasizes the small values. If you don't want logarithmic spectra, then
check the "Raw power spectrum" option.

I guess that IJ is creating a gray-value image before
Fourier-transforming the RGB-image and it does this according to the
choice made under "Conversion Options". Most probably you have "Weighted
RGB Conversion" checked.

HTH

Herbie

On 27.07.13 16:10, Jack Hogan wrote:

> Hello folks,
>
> Can any of you Imagej experts illuminate a noob as to why the FFT Power
> Spectra of two image types of the exact same image look so different?
>   Specifically, referring to the attached image, the top row is the 8bit RGB
> rendition of a raw file with minimal demosaicing and its FFT.  The bottom
> row is the same RGB 8 bit rendition but after having been 'stacked' through
> Image/Color/MakeComposite and an FFT generated for each color slice.
>
> How does Imagej's FFT algorithm combine the separate RGB channels to come
> up with its power spectrum? And why is it so different from the individual
> channels'?
>
> Thank you for your help.
>
> Jack
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Jack Hogan
Hi Herbie,

Yeah, I thought that Imagej would turn the image from RGB to 8 bit gray
before running the FFT on it, but apparently not.  The attached image shows
running FFT on the RGB image, on the RGB image after converting to 8 bit
gray and on the sum of the R, G, B slices divided by three respectively.

The Raw Power Spectrum is not very helpful (a single dot with scaling, or
mostly washed out without).  Image conversion options are at default, which
means that the weighted RGB box is unchecked.

The FFT run directly on the RGB image still looks quite different from the
others.  Any other ideas?

Thanks for your help!

Jack


On Sat, Jul 27, 2013 at 5:04 PM, Herbie <[hidden email]> wrote:

> Good day Jack,
>
> the differences may appear big in the display but please note that the
> Fourier-spectral values are scaled according to the logarithm which
> emphasizes the small values. If you don't want logarithmic spectra, then
> check the "Raw power spectrum" option.
>
> I guess that IJ is creating a gray-value image before Fourier-transforming
> the RGB-image and it does this according to the choice made under
> "Conversion Options". Most probably you have "Weighted RGB Conversion"
> checked.
>
> HTH
>
> Herbie
>
>
> On 27.07.13 16:10, Jack Hogan wrote:
>
>> Hello folks,
>>
>> Can any of you Imagej experts illuminate a noob as to why the FFT Power
>> Spectra of two image types of the exact same image look so different?
>>   Specifically, referring to the attached image, the top row is the 8bit
>> RGB
>> rendition of a raw file with minimal demosaicing and its FFT.  The bottom
>> row is the same RGB 8 bit rendition but after having been 'stacked'
>> through
>> Image/Color/MakeComposite and an FFT generated for each color slice.
>>
>> How does Imagej's FFT algorithm combine the separate RGB channels to come
>> up with its power spectrum? And why is it so different from the individual
>> channels'?
>>
>> Thank you for your help.
>>
>> Jack
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
>>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

FFT RGB vs 8b vs R+G+B_3.jpg (182K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

James Ewing
Jack - to form the modulus image of the FT sum of the RGB channels, try Sum = sqrt(R^2 + G^2 + B^2)
 -  Jim Ewing

On Jul 27, 2013, at 1:07 PM, Jack Hogan wrote:

> Hi Herbie,
>
> Yeah, I thought that Imagej would turn the image from RGB to 8 bit gray
> before running the FFT on it, but apparently not.  The attached image shows
> running FFT on the RGB image, on the RGB image after converting to 8 bit
> gray and on the sum of the R, G, B slices divided by three respectively.
>
> The Raw Power Spectrum is not very helpful (a single dot with scaling, or
> mostly washed out without).  Image conversion options are at default, which
> means that the weighted RGB box is unchecked.
>
> The FFT run directly on the RGB image still looks quite different from the
> others.  Any other ideas?
>
> Thanks for your help!
>
> Jack
>
>
> On Sat, Jul 27, 2013 at 5:04 PM, Herbie <[hidden email]> wrote:
>
>> Good day Jack,
>>
>> the differences may appear big in the display but please note that the
>> Fourier-spectral values are scaled according to the logarithm which
>> emphasizes the small values. If you don't want logarithmic spectra, then
>> check the "Raw power spectrum" option.
>>
>> I guess that IJ is creating a gray-value image before Fourier-transforming
>> the RGB-image and it does this according to the choice made under
>> "Conversion Options". Most probably you have "Weighted RGB Conversion"
>> checked.
>>
>> HTH
>>
>> Herbie
>>
>>
>> On 27.07.13 16:10, Jack Hogan wrote:
>>
>>> Hello folks,
>>>
>>> Can any of you Imagej experts illuminate a noob as to why the FFT Power
>>> Spectra of two image types of the exact same image look so different?
>>>  Specifically, referring to the attached image, the top row is the 8bit
>>> RGB
>>> rendition of a raw file with minimal demosaicing and its FFT.  The bottom
>>> row is the same RGB 8 bit rendition but after having been 'stacked'
>>> through
>>> Image/Color/MakeComposite and an FFT generated for each color slice.
>>>
>>> How does Imagej's FFT algorithm combine the separate RGB channels to come
>>> up with its power spectrum? And why is it so different from the individual
>>> channels'?
>>>
>>> Thank you for your help.
>>>
>>> Jack
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>>
>>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> <FFT RGB vs 8b vs R+G+B_3.jpg>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Jack Hogan
Hey Jim,

Thanks, your suggestion seemed promising.  I produced both the FFT of the
quadrature sum of the R,G and B values and the quadrature sum of the
individual channels' Power Spectrum.  The Power Spectrum obtained by IJ's
FFT function directly on the RGB image looks closest to the latter (see the
rightmost column in the FFT Moduli image), but alas nowhere near the same
as you can see in the two attachments.

Getting closer but not quite there yet.  Any other ideas?

Jack


On Sat, Jul 27, 2013 at 8:49 PM, James Ewing <[hidden email]>wrote:

> Jack - to form the modulus image of the FT sum of the RGB channels, try
> Sum = sqrt(R^2 + G^2 + B^2)
>  -  Jim Ewing
>
> On Jul 27, 2013, at 1:07 PM, Jack Hogan wrote:
>
> > Hi Herbie,
> >
> > Yeah, I thought that Imagej would turn the image from RGB to 8 bit gray
> > before running the FFT on it, but apparently not.  The attached image
> shows
> > running FFT on the RGB image, on the RGB image after converting to 8 bit
> > gray and on the sum of the R, G, B slices divided by three respectively.
> >
> > The Raw Power Spectrum is not very helpful (a single dot with scaling, or
> > mostly washed out without).  Image conversion options are at default,
> which
> > means that the weighted RGB box is unchecked.
> >
> > The FFT run directly on the RGB image still looks quite different from
> the
> > others.  Any other ideas?
> >
> > Thanks for your help!
> >
> > Jack
> >
> >
> > On Sat, Jul 27, 2013 at 5:04 PM, Herbie <[hidden email]> wrote:
> >
> >> Good day Jack,
> >>
> >> the differences may appear big in the display but please note that the
> >> Fourier-spectral values are scaled according to the logarithm which
> >> emphasizes the small values. If you don't want logarithmic spectra, then
> >> check the "Raw power spectrum" option.
> >>
> >> I guess that IJ is creating a gray-value image before
> Fourier-transforming
> >> the RGB-image and it does this according to the choice made under
> >> "Conversion Options". Most probably you have "Weighted RGB Conversion"
> >> checked.
> >>
> >> HTH
> >>
> >> Herbie
> >>
> >>
> >> On 27.07.13 16:10, Jack Hogan wrote:
> >>
> >>> Hello folks,
> >>>
> >>> Can any of you Imagej experts illuminate a noob as to why the FFT Power
> >>> Spectra of two image types of the exact same image look so different?
> >>>  Specifically, referring to the attached image, the top row is the 8bit
> >>> RGB
> >>> rendition of a raw file with minimal demosaicing and its FFT.  The
> bottom
> >>> row is the same RGB 8 bit rendition but after having been 'stacked'
> >>> through
> >>> Image/Color/MakeComposite and an FFT generated for each color slice.
> >>>
> >>> How does Imagej's FFT algorithm combine the separate RGB channels to
> come
> >>> up with its power spectrum? And why is it so different from the
> individual
> >>> channels'?
> >>>
> >>> Thank you for your help.
> >>>
> >>> Jack
> >>>
> >>> --
> >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<
> http://imagej.nih.gov/ij/list.html>
> >>>
> >>>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<
> http://imagej.nih.gov/ij/list.html>
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > <FFT RGB vs 8b vs R+G+B_3.jpg>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Quadrature Sum of Slices.jpg (229K) Download Attachment
FFT Moduli Ops.jpg (104K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Gabriel Landini
On Sunday 28 Jul 2013 09:33:59Jack Hogan wrote:
> Thanks, your suggestion seemed promising.  I produced both the FFT of the
> quadrature sum of the R,G and B values and the quadrature sum of the
> individual channels' Power Spectrum.  The Power Spectrum obtained by IJ's
> FFT function directly on the RGB image looks closest to the latter (see the
> rightmost column in the FFT Moduli image), but alas nowhere near the same
> as you can see in the two attachments.
>
> Getting closer but not quite there yet.  Any other ideas?

I would stop experimenting and look in the source code. Even if it looks very
close, you will not be sure that what you do is what the code does.

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Herbie-3
Good day Jack,

as Gabriel suggested, it is a good idea to have a look at the source code...

In doing so you might find that "getBrightness()" is the routine in
question which in turn calls "Color.RGBtoHSB()".

If you do an "RGB to HSB"-conversion (e.g. by using the plug-in "Color
Transformer") and take the brightness channel for the ImageJ
logPower-spectra generation, then the results are identical to the
direct logPower-spectra generation from the RGB-image, at least for me.
(HSB is also known as HSV.)

In essence and as expected in my first reply, the difference is due to
the kind of RGB to gray-value conversion. There are endless ways of
doing this.

Finally, I understand that you may need logPower-spectra but you should
be aware that the differences that you've found are in fact really small
when considering the Power-spectra per se.

Best

Herbie

_________________________________________
On 28.07.13 10:48, Gabriel Landini wrote:

> On Sunday 28 Jul 2013 09:33:59Jack Hogan wrote:
>> Thanks, your suggestion seemed promising.  I produced both the FFT of the
>> quadrature sum of the R,G and B values and the quadrature sum of the
>> individual channels' Power Spectrum.  The Power Spectrum obtained by IJ's
>> FFT function directly on the RGB image looks closest to the latter (see the
>> rightmost column in the FFT Moduli image), but alas nowhere near the same
>> as you can see in the two attachments.
>>
>> Getting closer but not quite there yet.  Any other ideas?
>
> I would stop experimenting and look in the source code. Even if it looks very
> close, you will not be sure that what you do is what the code does.
>
> Cheers
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Fwd: FFT Power Spectrum Question: RGB vs 8-bit stack

Jack Hogan
---------- Forwarded message ----------
From: Jack Hogan <[hidden email]>
Date: Sun, Jul 28, 2013 at 4:26 PM
Subject: Re: FFT Power Spectrum Question: RGB vs 8-bit stack
To: [hidden email]


Thank you Herbie, Jim and Gabriel, being a noob, even if I knew how to look
at the source code I am not sure I would understand what it meant:-)

But with your hints I think I got it, assuming that FFT is run on HSB's
'Brightness': According to Burger and Burge Brightness in 'RGB to HSB'
appears to be computed for each pixel simply by taking the largest value of
R, G or B.  That's quite different from Y, a variation of which I was
erroneously assuming would be the basis for the transform.

Thanks again for your helpful suggestions.
Jack



On Sun, Jul 28, 2013 at 3:54 PM, Herbie <[hidden email]> wrote:

> Good day Jack,
>
> as Gabriel suggested, it is a good idea to have a look at the source
> code...
>
> In doing so you might find that "getBrightness()" is the routine in
> question which in turn calls "Color.RGBtoHSB()".
>
> If you do an "RGB to HSB"-conversion (e.g. by using the plug-in "Color
> Transformer") and take the brightness channel for the ImageJ
> logPower-spectra generation, then the results are identical to the direct
> logPower-spectra generation from the RGB-image, at least for me.
> (HSB is also known as HSV.)
>
> In essence and as expected in my first reply, the difference is due to the
> kind of RGB to gray-value conversion. There are endless ways of doing this.
>
> Finally, I understand that you may need logPower-spectra but you should be
> aware that the differences that you've found are in fact really small when
> considering the Power-spectra per se.
>
> Best
>
> Herbie
>
> ______________________________**___________
>
> On 28.07.13 10:48, Gabriel Landini wrote:
>
>> On Sunday 28 Jul 2013 09:33:59Jack Hogan wrote:
>>
>>> Thanks, your suggestion seemed promising.  I produced both the FFT of the
>>> quadrature sum of the R,G and B values and the quadrature sum of the
>>> individual channels' Power Spectrum.  The Power Spectrum obtained by IJ's
>>> FFT function directly on the RGB image looks closest to the latter (see
>>> the
>>> rightmost column in the FFT Moduli image), but alas nowhere near the same
>>> as you can see in the two attachments.
>>>
>>> Getting closer but not quite there yet.  Any other ideas?
>>>
>>
>> I would stop experimenting and look in the source code. Even if it looks
>> very
>> close, you will not be sure that what you do is what the code does.
>>
>> Cheers
>> Gabriel
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>>
>>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.**html<http://imagej.nih.gov/ij/list.html>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: FFT Power Spectrum Question: RGB vs 8-bit stack

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Jack Hogan
On Jul 27, 2013; 10:10am, Jack Hogan wrote:

> Hello folks,
>
> Can any of you Imagej experts illuminate a noob as to why the FFT Power
> Spectra of two image types of the exact same image look so different?
> Specifically, referring to the attached image, the top row is the 8bit RGB
> rendition of a raw file with minimal demosaicing and its FFT.  The bottom
> row is the same RGB 8 bit rendition but after having been 'stacked' through
> Image/Color/MakeComposite and an FFT generated for each color slice.
>
> How does Imagej's FFT algorithm combine the separate RGB channels to come
> up with its power spectrum? And why is it so different from the individual
> channels'?
>
> Thank you for your help.

Thanks to Michael Schmid, the ImageJ 1.48b daily build fixes a bug that caused the FFT power spectra of RGB images to not be correctly log scaled. ImageJ does FFTs on RGB images by splitting the image into hue, saturation and brightness channels and FFT transforming the brightness channel. The Inverse FFT command merges the hue, saturation and (inverse transformed) brightness channels to create and RGB image.

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html