FFT averaging

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

FFT averaging

Gary Sellani
I did a search on the list archive and fft yielded nothing, something I
seriously doubt is the case. I used
https://list.nih.gov/cgi-bin/wa.exe

In any event, I can use Imagej to take the FFT of an image without
issue. Both the "FFT window" and "complex FFT" work. But what I'd like
to do is to average a few FFTs of some images, then take the inverse of
that result.

You can put the "FFT Window" images into a stack, but it just saves the
2D magitude, so when you average the slices, the result cannot be put
through the inverse FFT.

Using the complex FFT, I cam create a stack of real and a stack of
imaginary, average each stack individually, but then the inverse FFT
doesn't recognize it as a complex image.
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Bob Loushin
Average the images first, then do the FFT.  Yes, you will get the same
result, regardless of the order of the two operations.


--------------------------------------------------
From: "gary" <[hidden email]>
Sent: Thursday, April 22, 2010 4:53 PM
To: <[hidden email]>
Subject: FFT averaging

> I did a search on the list archive and fft yielded nothing, something I
> seriously doubt is the case. I used
> https://list.nih.gov/cgi-bin/wa.exe
>
> In any event, I can use Imagej to take the FFT of an image without issue.
> Both the "FFT window" and "complex FFT" work. But what I'd like to do is
> to average a few FFTs of some images, then take the inverse of that
> result.
>
> You can put the "FFT Window" images into a stack, but it just saves the 2D
> magitude, so when you average the slices, the result cannot be put through
> the inverse FFT.
>
> Using the complex FFT, I cam create a stack of real and a stack of
> imaginary, average each stack individually, but then the inverse FFT
> doesn't recognize it as a complex image.
>
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Gary Sellani
Are you positive? This wouldn't work in the one dimensional case.
-----Original Message-----
From:         Bob <[hidden email]>
Date:         Thu, 22 Apr 2010 17:21:41
To: <[hidden email]>
Subject: Re: FFT averaging

Average the images first, then do the FFT.  Yes, you will get the same
result, regardless of the order of the two operations.


--------------------------------------------------
From: "gary" <[hidden email]>
Sent: Thursday, April 22, 2010 4:53 PM
To: <[hidden email]>
Subject: FFT averaging

> I did a search on the list archive and fft yielded nothing, something I
> seriously doubt is the case. I used
> https://list.nih.gov/cgi-bin/wa.exe
>
> In any event, I can use Imagej to take the FFT of an image without issue.
> Both the "FFT window" and "complex FFT" work. But what I'd like to do is
> to average a few FFTs of some images, then take the inverse of that
> result.
>
> You can put the "FFT Window" images into a stack, but it just saves the 2D
> magitude, so when you average the slices, the result cannot be put through
> the inverse FFT.
>
> Using the complex FFT, I cam create a stack of real and a stack of
> imaginary, average each stack individually, but then the inverse FFT
> doesn't recognize it as a complex image.
>
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Robert Dougherty
Gary,

I agree with Bob (the other Bob), as long as what you want to average is the original images on the one hand and the complex FFT (or the FHT) on the other hand.  Averaging and transforming are both linear operations, so it does not matter what order you do them in: average(transform(images)) = transform(averages(images)).  There are types of processing in which you want to average the power spectra of the various images. (At least there are times you want to do this in regular signal processing of a Short Time Fourier Transform.  I'm not sure when it applies in image processing.)  Squaring to get the power spectra levels is a nonlinear operation, so it would not work to average the images first in this case.

Bob D.

On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:

> Are you positive? This wouldn't work in the one dimensional case.
> -----Original Message-----
> From:         Bob <[hidden email]>
> Date:         Thu, 22 Apr 2010 17:21:41
> To: <[hidden email]>
> Subject: Re: FFT averaging
>
> Average the images first, then do the FFT.  Yes, you will get the same
> result, regardless of the order of the two operations.
>
>
> --------------------------------------------------
> From: "gary" <[hidden email]>
> Sent: Thursday, April 22, 2010 4:53 PM
> To: <[hidden email]>
> Subject: FFT averaging
>
>> I did a search on the list archive and fft yielded nothing, something I
>> seriously doubt is the case. I used
>> https://list.nih.gov/cgi-bin/wa.exe
>>
>> In any event, I can use Imagej to take the FFT of an image without issue.
>> Both the "FFT window" and "complex FFT" work. But what I'd like to do is
>> to average a few FFTs of some images, then take the inverse of that
>> result.
>>
>> You can put the "FFT Window" images into a stack, but it just saves the 2D
>> magitude, so when you average the slices, the result cannot be put through
>> the inverse FFT.
>>
>> Using the complex FFT, I cam create a stack of real and a stack of
>> imaginary, average each stack individually, but then the inverse FFT
>> doesn't recognize it as a complex image.
>>

Robert Dougherty, Ph.D.
President, OptiNav, Inc.
4176 148th Ave. NE
Redmond, WA 98052
(425)891-4883
FAX (425)467-1119
www.optinav.com
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Gary Sellani
Ok. Thanks to both of you.

I guess I have to dust off my Oppenhein and Schafer. Still I have to
wonder why periodograms are averaged in the frequency domain if the time
domain would work as well.

What I was wondering is would stacking FFTs of images of one target that
contain thermal distortion would yield a sharper image, but if the
operation is linear in either domain, then this is a dead end to
explore. I know that stacking where parts of the image have wiggled will
just create a blur at those spots.

Incidentally, I had some issues getting imagej working on my windows 7
64 bit machine. It worked fine under X64. No big deal since I have a few
linux boxes at my disposal and it is trivial to run imagej under linux.
[The are not many multiplatform programs where linux is the easiest
port!] I suspect a permission problem with windows 7 since it bombed
when trying to write the configuration file.

On 4/22/2010 8:10 PM, Robert Dougherty wrote:

> Gary,
>
> I agree with Bob (the other Bob), as long as what you want to average is the original images on the one hand and the complex FFT (or the FHT) on the other hand.  Averaging and transforming are both linear operations, so it does not matter what order you do them in: average(transform(images)) = transform(averages(images)).  There are types of processing in which you want to average the power spectra of the various images. (At least there are times you want to do this in regular signal processing of a Short Time Fourier Transform.  I'm not sure when it applies in image processing.)  Squaring to get the power spectra levels is a nonlinear operation, so it would not work to average the images first in this case.
>
> Bob D.
>
> On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:
>
>> Are you positive? This wouldn't work in the one dimensional case.
>> -----Original Message-----
>> From:         Bob<[hidden email]>
>> Date:         Thu, 22 Apr 2010 17:21:41
>> To:<[hidden email]>
>> Subject: Re: FFT averaging
>>
>> Average the images first, then do the FFT.  Yes, you will get the same
>> result, regardless of the order of the two operations.
>>
>>
>> --------------------------------------------------
>> From: "gary"<[hidden email]>
>> Sent: Thursday, April 22, 2010 4:53 PM
>> To:<[hidden email]>
>> Subject: FFT averaging
>>
>>> I did a search on the list archive and fft yielded nothing, something I
>>> seriously doubt is the case. I used
>>> https://list.nih.gov/cgi-bin/wa.exe
>>>
>>> In any event, I can use Imagej to take the FFT of an image without issue.
>>> Both the "FFT window" and "complex FFT" work. But what I'd like to do is
>>> to average a few FFTs of some images, then take the inverse of that
>>> result.
>>>
>>> You can put the "FFT Window" images into a stack, but it just saves the 2D
>>> magitude, so when you average the slices, the result cannot be put through
>>> the inverse FFT.
>>>
>>> Using the complex FFT, I cam create a stack of real and a stack of
>>> imaginary, average each stack individually, but then the inverse FFT
>>> doesn't recognize it as a complex image.
>>>
>
> Robert Dougherty, Ph.D.
> President, OptiNav, Inc.
> 4176 148th Ave. NE
> Redmond, WA 98052
> (425)891-4883
> FAX (425)467-1119
> www.optinav.com
> [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: FFT averaging

Joachim Wesner
Hi there

>I guess I have to dust off my Oppenhein and Schafer. Still I have to
>wonder why periodograms are averaged in the frequency domain if the time
>domain would work as well.

If you imagine the SAME 1 or 2D distribution (image) invariant over time
(within a stack), with only
variable noise, averaging the input distribution or averaging the final
*complex* FFT spectrum
will give the same result.

If the input distribution changes over time / within the stack, clearly in
the limit of many images
the average of the input will vanish (cancel out) as will the average of
the individual complex transforms.

This will likely happen even if the individual "frequency contents" within
the images are similar,
because the phase relations in the general case will not be "congruent"
with the "sampling interval"
between the images.

However,if you only want to know the "power spectrum" of a time variant
distribution, you can average
over the individual power spectra which are not "phase sensitive". I think
this is what you refer to in
"averaging of peridograms in the frequency domain"

Mit freundlichen Grüßen / Best regards

Joachim Wesner

Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. David Roy Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Michael Schmid
In reply to this post by Gary Sellani
Hi Gary,

according to the Wikipedia site, a periodogram plots the square root  
of the power spectrum, not the real and imaginary values. So it is a  
nonlinear operation, and there is a difference between averaging  
before and after the 'periodgram' operation.

Thermal distortion - I am not sure that I understand you correctly.
Do you have thermal drift of the image, and you want to register the  
images and then average over them? In that case, I'd use one of the  
image registration plugins. Registration via the Fourier domain works  
best in case of a uniform background (such as images of planets with  
a black background in astronomy; the program Registax is designed for  
this and uses the Fourier transform for registration). Otherwise you  
have to get rid of edge effects; a smooth window function will be  
helpful, but not full solve the problem.

Michael
________________________________________________________________

On 23 Apr 2010, at 05:31, gary wrote:

> Ok. Thanks to both of you.
>
> I guess I have to dust off my Oppenhein and Schafer. Still I have  
> to wonder why periodograms are averaged in the frequency domain if  
> the time domain would work as well.
>
> What I was wondering is would stacking FFTs of images of one target  
> that contain thermal distortion would yield a sharper image, but if  
> the operation is linear in either domain, then this is a dead end  
> to explore. I know that stacking where parts of the image have  
> wiggled will just create a blur at those spots.
>
> Incidentally, I had some issues getting imagej working on my  
> windows 7 64 bit machine. It worked fine under X64. No big deal  
> since I have a few linux boxes at my disposal and it is trivial to  
> run imagej under linux. [The are not many multiplatform programs  
> where linux is the easiest port!] I suspect a permission problem  
> with windows 7 since it bombed when trying to write the  
> configuration file.
>
> On 4/22/2010 8:10 PM, Robert Dougherty wrote:
>> Gary,
>>
>> I agree with Bob (the other Bob), as long as what you want to  
>> average is the original images on the one hand and the complex FFT  
>> (or the FHT) on the other hand.  Averaging and transforming are  
>> both linear operations, so it does not matter what order you do  
>> them in: average(transform(images)) = transform(averages
>> (images)).  There are types of processing in which you want to  
>> average the power spectra of the various images. (At least there  
>> are times you want to do this in regular signal processing of a  
>> Short Time Fourier Transform.  I'm not sure when it applies in  
>> image processing.)  Squaring to get the power spectra levels is a  
>> nonlinear operation, so it would not work to average the images  
>> first in this case.
>>
>> Bob D.
>>
>> On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:
>>
>>> Are you positive? This wouldn't work in the one dimensional case.
>>> -----Original Message-----
>>> From:         Bob<[hidden email]>
>>> Date:         Thu, 22 Apr 2010 17:21:41
>>> To:<[hidden email]>
>>> Subject: Re: FFT averaging
>>>
>>> Average the images first, then do the FFT.  Yes, you will get the  
>>> same
>>> result, regardless of the order of the two operations.
>>>
>>>
>>> --------------------------------------------------
>>> From: "gary"<[hidden email]>
>>> Sent: Thursday, April 22, 2010 4:53 PM
>>> To:<[hidden email]>
>>> Subject: FFT averaging
>>>
>>>> I did a search on the list archive and fft yielded nothing,  
>>>> something I
>>>> seriously doubt is the case. I used
>>>> https://list.nih.gov/cgi-bin/wa.exe
>>>>
>>>> In any event, I can use Imagej to take the FFT of an image  
>>>> without issue.
>>>> Both the "FFT window" and "complex FFT" work. But what I'd like  
>>>> to do is
>>>> to average a few FFTs of some images, then take the inverse of that
>>>> result.
>>>>
>>>> You can put the "FFT Window" images into a stack, but it just  
>>>> saves the 2D
>>>> magitude, so when you average the slices, the result cannot be  
>>>> put through
>>>> the inverse FFT.
>>>>
>>>> Using the complex FFT, I cam create a stack of real and a stack of
>>>> imaginary, average each stack individually, but then the inverse  
>>>> FFT
>>>> doesn't recognize it as a complex image.
>>>>
>>
>> Robert Dougherty, Ph.D.
>> President, OptiNav, Inc.
>> 4176 148th Ave. NE
>> Redmond, WA 98052
>> (425)891-4883
>> FAX (425)467-1119
>> www.optinav.com
>> [hidden email]
>>
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

Gary Sellani
Ah, the square root jogs my memory, and of course all bets are off when you perform nonlinear functions. I really need to reread this stuff.

The thermal distortion is the time variant warping you see when using a telescope in the daylight looking over land. A fluttering in the low Hertz (say 10Hz). A camera at a reasonable shutter speed (say 1/125 second) with multiple exposures records many images of the same target with different warping as the live image flutters.

It seems like there should be a way to combine these images to get a more accurate image, that is the unwarped image.

Now if the is not the case, I guess second best would be a motion flow scheme where the frame with the least motion would be picked. I essentially do this now by hand by picking the sharpest image.

Failing those choices, is there a way to have imagej quantify the sharpness of an image, that is a measure of the highest frequency component in the FFT?


 
-----Original Message-----
From:         Michael Schmid <[hidden email]>
Date:         Fri, 23 Apr 2010 11:19:27
To: <[hidden email]>
Subject: Re: FFT averaging

Hi Gary,

according to the Wikipedia site, a periodogram plots the square root  
of the power spectrum, not the real and imaginary values. So it is a  
nonlinear operation, and there is a difference between averaging  
before and after the 'periodgram' operation.

Thermal distortion - I am not sure that I understand you correctly.
Do you have thermal drift of the image, and you want to register the  
images and then average over them? In that case, I'd use one of the  
image registration plugins. Registration via the Fourier domain works  
best in case of a uniform background (such as images of planets with  
a black background in astronomy; the program Registax is designed for  
this and uses the Fourier transform for registration). Otherwise you  
have to get rid of edge effects; a smooth window function will be  
helpful, but not full solve the problem.

Michael
________________________________________________________________

On 23 Apr 2010, at 05:31, gary wrote:

> Ok. Thanks to both of you.
>
> I guess I have to dust off my Oppenhein and Schafer. Still I have  
> to wonder why periodograms are averaged in the frequency domain if  
> the time domain would work as well.
>
> What I was wondering is would stacking FFTs of images of one target  
> that contain thermal distortion would yield a sharper image, but if  
> the operation is linear in either domain, then this is a dead end  
> to explore. I know that stacking where parts of the image have  
> wiggled will just create a blur at those spots.
>
> Incidentally, I had some issues getting imagej working on my  
> windows 7 64 bit machine. It worked fine under X64. No big deal  
> since I have a few linux boxes at my disposal and it is trivial to  
> run imagej under linux. [The are not many multiplatform programs  
> where linux is the easiest port!] I suspect a permission problem  
> with windows 7 since it bombed when trying to write the  
> configuration file.
>
> On 4/22/2010 8:10 PM, Robert Dougherty wrote:
>> Gary,
>>
>> I agree with Bob (the other Bob), as long as what you want to  
>> average is the original images on the one hand and the complex FFT  
>> (or the FHT) on the other hand.  Averaging and transforming are  
>> both linear operations, so it does not matter what order you do  
>> them in: average(transform(images)) = transform(averages
>> (images)).  There are types of processing in which you want to  
>> average the power spectra of the various images. (At least there  
>> are times you want to do this in regular signal processing of a  
>> Short Time Fourier Transform.  I'm not sure when it applies in  
>> image processing.)  Squaring to get the power spectra levels is a  
>> nonlinear operation, so it would not work to average the images  
>> first in this case.
>>
>> Bob D.
>>
>> On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:
>>
>>> Are you positive? This wouldn't work in the one dimensional case.
>>> -----Original Message-----
>>> From:         Bob<[hidden email]>
>>> Date:         Thu, 22 Apr 2010 17:21:41
>>> To:<[hidden email]>
>>> Subject: Re: FFT averaging
>>>
>>> Average the images first, then do the FFT.  Yes, you will get the  
>>> same
>>> result, regardless of the order of the two operations.
>>>
>>>
>>> --------------------------------------------------
>>> From: "gary"<[hidden email]>
>>> Sent: Thursday, April 22, 2010 4:53 PM
>>> To:<[hidden email]>
>>> Subject: FFT averaging
>>>
>>>> I did a search on the list archive and fft yielded nothing,  
>>>> something I
>>>> seriously doubt is the case. I used
>>>> https://list.nih.gov/cgi-bin/wa.exe
>>>>
>>>> In any event, I can use Imagej to take the FFT of an image  
>>>> without issue.
>>>> Both the "FFT window" and "complex FFT" work. But what I'd like  
>>>> to do is
>>>> to average a few FFTs of some images, then take the inverse of that
>>>> result.
>>>>
>>>> You can put the "FFT Window" images into a stack, but it just  
>>>> saves the 2D
>>>> magitude, so when you average the slices, the result cannot be  
>>>> put through
>>>> the inverse FFT.
>>>>
>>>> Using the complex FFT, I cam create a stack of real and a stack of
>>>> imaginary, average each stack individually, but then the inverse  
>>>> FFT
>>>> doesn't recognize it as a complex image.
>>>>
>>
>> Robert Dougherty, Ph.D.
>> President, OptiNav, Inc.
>> 4176 148th Ave. NE
>> Redmond, WA 98052
>> (425)891-4883
>> FAX (425)467-1119
>> www.optinav.com
>> [hidden email]
>>
Reply | Threaded
Open this post in threaded view
|

Re: FFT averaging

drix
In reply to this post by Gary Sellani
Hi Gary,

On Thu, Apr 22, 2010 at 11:31 PM, gary <[hidden email]> wrote:
> Ok. Thanks to both of you.
...
> Incidentally, I had some issues getting imagej working on my windows 7 64
> bit machine. It worked fine under X64. No big deal since I have a few linux
> boxes at my disposal and it is trivial to run imagej under linux. [The are
> not many multiplatform programs where linux is the easiest port!] I suspect
> a permission problem with windows 7 since it bombed when trying to write the
> configuration file.

For you windows 7 problems, I have no problem after I install ImageJ
in another folder created by the user like C:\userName\bin.

Hendrix
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: FFT averaging

Joachim Wesner
In reply to this post by Michael Schmid
>according to the Wikipedia site, a periodogram plots the square root
>of the power spectrum, not the real and imaginary values. So it is a
>nonlinear operation, and there is a difference between averaging
>before and after the 'periodgram' operation.

Hi Michael,

as I tried to explain in my other post, it is not so much (or not only) the
nonlinearity
of the square root operation that causes the big difference, but that you
throw
away the phase when calculating the power spectrum, which is abs(c)^2 =
Re(c)^2+Im(c)^2
and always positive. The/A difference to averaging the input data resp.
doing a full
complex average of the spectrum would also remain without the square root.

Mit freundlichen Grüßen / Best regards

Joachim Wesner


Leica Microsystems CMS GmbH | GmbH mit Sitz in Wetzlar | Amtsgericht
Wetzlar  HRB 2432
Geschäftsführer:  Dr. Stefan Traeger | Dr. David Roy Martyr | Colin Davis
www.leica-microsystems.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: Re: FFT averaging

Michael Schmid
Hi Gary,

ok, as I understand it now, you are talking about what astronomers  
call "seeing".
   http://en.wikipedia.org/wiki/Astronomical_seeing
There are several effects related to it - image shift and distortion  
(most noticeable if the lens is smaller than the convection cell  
size) and blurring.
Distortion can be handled by some registration plug-ins like(b)UnwarpJ.

Finding sharpness:
You can either get the power spectrum (from the FFT options; don't  
take the displayed image of an FFT which has arbitrary log scaling)  
and either measure the mean in a ROI or multiply by some mask  
function of your choice and then determine the mean.
If I remember well, the description of the Registax program has a  
note on how to select that frequency range.
Another way to determine sharpness is simply running a high-pass  
filter (e.g., the one from http://imagejdocu.tudor.lu/doku.php?
id=plugin:filter:highpass_filter:start ), maybe after some noise  
suppression, and then determine the standard deviation.

I think that programs like Giotto and Registax use several criteria  
to find the best images, including sharpness and agreement with the  
average of the best one - have a look at their web pages and manuals.


[ @Joachim:  When I wrote in my previous post "square root of the  
power spectrum" i meant both operations, power spectrum and square  
root, as being nonlinear. You may consider the power spectrum worse  
than the square root, ok, but any nonlinear operation is sufficient  
to make a difference between averaging before and after the operation ]

Michael
________________________________________________________________

On 23 Apr 2010, at 11:37, Gary Sellani wrote:


> Ah, the square root jogs my memory, and of course all bets are off  
> when you perform nonlinear functions. I really need to reread this  
> stuff.
>
> The thermal distortion is the time variant warping you see when  
> using a telescope in the daylight looking over land. A fluttering  
> in the low Hertz (say 10Hz). A camera at a reasonable shutter speed  
> (say 1/125 second) with multiple exposures records many images of  
> the same target with different warping as the live image flutters.
>
> It seems like there should be a way to combine these images to get  
> a more accurate image, that is the unwarped image.
>
> Now if the is not the case, I guess second best would be a motion  
> flow scheme where the frame with the least motion would be picked.  
> I essentially do this now by hand by picking the sharpest image.
>
> Failing those choices, is there a way to have imagej quantify the  
> sharpness of an image, that is a measure of the highest frequency  
> component in the FFT?
>
>
>
> -----Original Message-----
> From:         Michael Schmid <[hidden email]>
> Date:         Fri, 23 Apr 2010 11:19:27
> To: <[hidden email]>
> Subject: Re: FFT averaging
>
> Hi Gary,
>
> according to the Wikipedia site, a periodogram plots the square root
> of the power spectrum, not the real and imaginary values. So it is a
> nonlinear operation, and there is a difference between averaging
> before and after the 'periodgram' operation.
>
> Thermal distortion - I am not sure that I understand you correctly.
> Do you have thermal drift of the image, and you want to register the
> images and then average over them? In that case, I'd use one of the
> image registration plugins. Registration via the Fourier domain works
> best in case of a uniform background (such as images of planets with
> a black background in astronomy; the program Registax is designed for
> this and uses the Fourier transform for registration). Otherwise you
> have to get rid of edge effects; a smooth window function will be
> helpful, but not full solve the problem.
>
> Michael
> ________________________________________________________________
>
> On 23 Apr 2010, at 05:31, gary wrote:
>
>
>> Ok. Thanks to both of you.
>>
>> I guess I have to dust off my Oppenhein and Schafer. Still I have
>> to wonder why periodograms are averaged in the frequency domain if
>> the time domain would work as well.
>>
>> What I was wondering is would stacking FFTs of images of one target
>> that contain thermal distortion would yield a sharper image, but if
>> the operation is linear in either domain, then this is a dead end
>> to explore. I know that stacking where parts of the image have
>> wiggled will just create a blur at those spots.
>>
>> Incidentally, I had some issues getting imagej working on my
>> windows 7 64 bit machine. It worked fine under X64. No big deal
>> since I have a few linux boxes at my disposal and it is trivial to
>> run imagej under linux. [The are not many multiplatform programs
>> where linux is the easiest port!] I suspect a permission problem
>> with windows 7 since it bombed when trying to write the
>> configuration file.
>>
>> On 4/22/2010 8:10 PM, Robert Dougherty wrote:
>>
>>> Gary,
>>>
>>> I agree with Bob (the other Bob), as long as what you want to
>>> average is the original images on the one hand and the complex FFT
>>> (or the FHT) on the other hand.  Averaging and transforming are
>>> both linear operations, so it does not matter what order you do
>>> them in: average(transform(images)) = transform(averages
>>> (images)).  There are types of processing in which you want to
>>> average the power spectra of the various images. (At least there
>>> are times you want to do this in regular signal processing of a
>>> Short Time Fourier Transform.  I'm not sure when it applies in
>>> image processing.)  Squaring to get the power spectra levels is a
>>> nonlinear operation, so it would not work to average the images
>>> first in this case.
>>>
>>> Bob D.
>>>
>>> On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:
>>>
>>>
>>>> Are you positive? This wouldn't work in the one dimensional case.
>>>> -----Original Message-----
>>>> From:         Bob<[hidden email]>
>>>> Date:         Thu, 22 Apr 2010 17:21:41
>>>> To:<[hidden email]>
>>>> Subject: Re: FFT averaging
>>>>
>>>> Average the images first, then do the FFT.  Yes, you will get the
>>>> same
>>>> result, regardless of the order of the two operations.
>>>>
>>>>
>>>> --------------------------------------------------
>>>> From: "gary"<[hidden email]>
>>>> Sent: Thursday, April 22, 2010 4:53 PM
>>>> To:<[hidden email]>
>>>> Subject: FFT averaging
>>>>
>>>>
>>>>> I did a search on the list archive and fft yielded nothing,
>>>>> something I
>>>>> seriously doubt is the case. I used
>>>>> https://list.nih.gov/cgi-bin/wa.exe
>>>>>
>>>>> In any event, I can use Imagej to take the FFT of an image
>>>>> without issue.
>>>>> Both the "FFT window" and "complex FFT" work. But what I'd like
>>>>> to do is
>>>>> to average a few FFTs of some images, then take the inverse of  
>>>>> that
>>>>> result.
>>>>>
>>>>> You can put the "FFT Window" images into a stack, but it just
>>>>> saves the 2D
>>>>> magitude, so when you average the slices, the result cannot be
>>>>> put through
>>>>> the inverse FFT.
>>>>>
>>>>> Using the complex FFT, I cam create a stack of real and a stack of
>>>>> imaginary, average each stack individually, but then the inverse
>>>>> FFT
>>>>> doesn't recognize it as a complex image.
>>>>>
>>>>>
>>>
>>> Robert Dougherty, Ph.D.
>>> President, OptiNav, Inc.
>>> 4176 148th Ave. NE
>>> Redmond, WA 98052
>>> (425)891-4883
>>> FAX (425)467-1119
>>> www.optinav.com
>>> [hidden email]
>>>
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: Re: FFT averaging

Gary Sellani
Yes seeing as in "poor seeing."

I am familiar with registax, but it is quite buggy. I will check out Giotto. And of course I will try the power spectrum measurement suggestions.


-----Original Message-----
From:         Michael Schmid <[hidden email]>
Date:         Fri, 23 Apr 2010 14:27:48
To: <[hidden email]>
Subject: Re: Antwort: Re: FFT averaging

Hi Gary,

ok, as I understand it now, you are talking about what astronomers  
call "seeing".
   http://en.wikipedia.org/wiki/Astronomical_seeing
There are several effects related to it - image shift and distortion  
(most noticeable if the lens is smaller than the convection cell  
size) and blurring.
Distortion can be handled by some registration plug-ins like(b)UnwarpJ.

Finding sharpness:
You can either get the power spectrum (from the FFT options; don't  
take the displayed image of an FFT which has arbitrary log scaling)  
and either measure the mean in a ROI or multiply by some mask  
function of your choice and then determine the mean.
If I remember well, the description of the Registax program has a  
note on how to select that frequency range.
Another way to determine sharpness is simply running a high-pass  
filter (e.g., the one from http://imagejdocu.tudor.lu/doku.php?
id=plugin:filter:highpass_filter:start ), maybe after some noise  
suppression, and then determine the standard deviation.

I think that programs like Giotto and Registax use several criteria  
to find the best images, including sharpness and agreement with the  
average of the best one - have a look at their web pages and manuals.


[ @Joachim:  When I wrote in my previous post "square root of the  
power spectrum" i meant both operations, power spectrum and square  
root, as being nonlinear. You may consider the power spectrum worse  
than the square root, ok, but any nonlinear operation is sufficient  
to make a difference between averaging before and after the operation ]

Michael
________________________________________________________________

On 23 Apr 2010, at 11:37, Gary Sellani wrote:


> Ah, the square root jogs my memory, and of course all bets are off  
> when you perform nonlinear functions. I really need to reread this  
> stuff.
>
> The thermal distortion is the time variant warping you see when  
> using a telescope in the daylight looking over land. A fluttering  
> in the low Hertz (say 10Hz). A camera at a reasonable shutter speed  
> (say 1/125 second) with multiple exposures records many images of  
> the same target with different warping as the live image flutters.
>
> It seems like there should be a way to combine these images to get  
> a more accurate image, that is the unwarped image.
>
> Now if the is not the case, I guess second best would be a motion  
> flow scheme where the frame with the least motion would be picked.  
> I essentially do this now by hand by picking the sharpest image.
>
> Failing those choices, is there a way to have imagej quantify the  
> sharpness of an image, that is a measure of the highest frequency  
> component in the FFT?
>
>
>
> -----Original Message-----
> From:         Michael Schmid <[hidden email]>
> Date:         Fri, 23 Apr 2010 11:19:27
> To: <[hidden email]>
> Subject: Re: FFT averaging
>
> Hi Gary,
>
> according to the Wikipedia site, a periodogram plots the square root
> of the power spectrum, not the real and imaginary values. So it is a
> nonlinear operation, and there is a difference between averaging
> before and after the 'periodgram' operation.
>
> Thermal distortion - I am not sure that I understand you correctly.
> Do you have thermal drift of the image, and you want to register the
> images and then average over them? In that case, I'd use one of the
> image registration plugins. Registration via the Fourier domain works
> best in case of a uniform background (such as images of planets with
> a black background in astronomy; the program Registax is designed for
> this and uses the Fourier transform for registration). Otherwise you
> have to get rid of edge effects; a smooth window function will be
> helpful, but not full solve the problem.
>
> Michael
> ________________________________________________________________
>
> On 23 Apr 2010, at 05:31, gary wrote:
>
>
>> Ok. Thanks to both of you.
>>
>> I guess I have to dust off my Oppenhein and Schafer. Still I have
>> to wonder why periodograms are averaged in the frequency domain if
>> the time domain would work as well.
>>
>> What I was wondering is would stacking FFTs of images of one target
>> that contain thermal distortion would yield a sharper image, but if
>> the operation is linear in either domain, then this is a dead end
>> to explore. I know that stacking where parts of the image have
>> wiggled will just create a blur at those spots.
>>
>> Incidentally, I had some issues getting imagej working on my
>> windows 7 64 bit machine. It worked fine under X64. No big deal
>> since I have a few linux boxes at my disposal and it is trivial to
>> run imagej under linux. [The are not many multiplatform programs
>> where linux is the easiest port!] I suspect a permission problem
>> with windows 7 since it bombed when trying to write the
>> configuration file.
>>
>> On 4/22/2010 8:10 PM, Robert Dougherty wrote:
>>
>>> Gary,
>>>
>>> I agree with Bob (the other Bob), as long as what you want to
>>> average is the original images on the one hand and the complex FFT
>>> (or the FHT) on the other hand.  Averaging and transforming are
>>> both linear operations, so it does not matter what order you do
>>> them in: average(transform(images)) = transform(averages
>>> (images)).  There are types of processing in which you want to
>>> average the power spectra of the various images. (At least there
>>> are times you want to do this in regular signal processing of a
>>> Short Time Fourier Transform.  I'm not sure when it applies in
>>> image processing.)  Squaring to get the power spectra levels is a
>>> nonlinear operation, so it would not work to average the images
>>> first in this case.
>>>
>>> Bob D.
>>>
>>> On Apr 22, 2010, at 4:50 PM, Gary Sellani wrote:
>>>
>>>
>>>> Are you positive? This wouldn't work in the one dimensional case.
>>>> -----Original Message-----
>>>> From:         Bob<[hidden email]>
>>>> Date:         Thu, 22 Apr 2010 17:21:41
>>>> To:<[hidden email]>
>>>> Subject: Re: FFT averaging
>>>>
>>>> Average the images first, then do the FFT.  Yes, you will get the
>>>> same
>>>> result, regardless of the order of the two operations.
>>>>
>>>>
>>>> --------------------------------------------------
>>>> From: "gary"<[hidden email]>
>>>> Sent: Thursday, April 22, 2010 4:53 PM
>>>> To:<[hidden email]>
>>>> Subject: FFT averaging
>>>>
>>>>
>>>>> I did a search on the list archive and fft yielded nothing,
>>>>> something I
>>>>> seriously doubt is the case. I used
>>>>> https://list.nih.gov/cgi-bin/wa.exe
>>>>>
>>>>> In any event, I can use Imagej to take the FFT of an image
>>>>> without issue.
>>>>> Both the "FFT window" and "complex FFT" work. But what I'd like
>>>>> to do is
>>>>> to average a few FFTs of some images, then take the inverse of  
>>>>> that
>>>>> result.
>>>>>
>>>>> You can put the "FFT Window" images into a stack, but it just
>>>>> saves the 2D
>>>>> magitude, so when you average the slices, the result cannot be
>>>>> put through
>>>>> the inverse FFT.
>>>>>
>>>>> Using the complex FFT, I cam create a stack of real and a stack of
>>>>> imaginary, average each stack individually, but then the inverse
>>>>> FFT
>>>>> doesn't recognize it as a complex image.
>>>>>
>>>>>
>>>
>>> Robert Dougherty, Ph.D.
>>> President, OptiNav, Inc.
>>> 4176 148th Ave. NE
>>> Redmond, WA 98052
>>> (425)891-4883
>>> FAX (425)467-1119
>>> www.optinav.com
>>> [hidden email]
>>>