Detecting grid size by using the FFT

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

Detecting grid size by using the FFT

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Gabriel Landini
On Monday 27 Feb 2012 12:06:37 you wrote:
> I am trying to automatically detect the grid size of counting chambers:
> http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
> My idea was to do this by applying the following steps:

Why detecting the grids to then count cells when you can create your own grids
in software as an overlay and compute cell numbers that way, with less errors?

The stereological principle should remain the same if you know the image
magnification and create your grids matching the size of those shown in the
image.

Cheers
Gabriel
.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Herbie-6
In reply to this post by verified.human
>Hi everybody,
>
>I am trying to automatically detect the grid size of counting chambers:
>http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
>My idea was to do this by applying the following steps:
>
>1) Crop the image to square size
>2) Calculate the MEAN of the image and subtract this value from all pixel
>values
>3) Calculate the FFT
>4) Find the maxima locations close to the center of the FFT and use the
>distance to the center to calculate the distance in pixels
>
>I am now stuck at step (4)...When I was searching how to do this I stumbled
>upon this post of Michael Schmid:
>http://imagej.1557.n6.nabble.com/fft-maxima-td3682605.html
>It seems that analyzing the FFT (from the window) is not a good idea (can
>anyone confirm this?). So I calculated the raw Power Spectrum, but I get a
>almost complete black image. I experimented with this a little, for example
>by subtracting (size^2) from the pixel values and applying a Math>Log. But
>there doesn't seem to change much...
>
>Can someone help me with this problem? A brief explanation of how this is
>usually done would be very helpful!
>Also it is not completely clear to me how I calculate the square size in
>pixels (px) from the FFT (or Power Spectrum).
>
>Thanks in advance!
>
>Best,
>
>Tom


Tom,

no problem here.

You may try to take the 4th square root of the Power Spectrum.
Yes, and don't forget to reset in the "Brightnness/Contrast"-Window.

HTH

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

verified.human
In reply to this post by verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Herbie-6
Dear,

as far as I measure, the smallest line distance is about 26 pixels.
This fits nicely with your spectral peak-distance of 40 which
corresponds to 25.6 pixels in the spatial domain.

                   Herbie

          ------------------------
          <http://www.gluender.de>


>Thanks guys!
>
>Applying gamma corrections or taking the nth order square root works!
>See: http://tweakers.net/ext/f/V05DVyciM7s0LIAtvfA7CRfR/full.png
>
>Now the only question that remains is how I calculate the size of the
>(smallest) squares of the grid in pixels.
>When I measure the size in the original image this is approximately 52
>pixels. The peak in the power spectrum that is closest to the center has a
>distance of ~40 pixels to the center of the PS.
>
>gr,
>
>Tom
>
>
>2012/2/27 Herbie <[hidden email]>
>
>>   Hi everybody,
>>>
>>>  I am trying to automatically detect the grid size of counting chambers:
>>>
>>>http://tweakers.net/ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png<http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png>
>>>  My idea was to do this by applying the following steps:
>>>
>>>  1) Crop the image to square size
>>>  2) Calculate the MEAN of the image and subtract this value from all pixel
>>>  values
>>>  3) Calculate the FFT
>>>  4) Find the maxima locations close to the center of the FFT and use the
>>>  distance to the center to calculate the distance in pixels
>>>
>>>  I am now stuck at step (4)...When I was searching how to do this I
>>>  stumbled
>>>  upon this post of Michael Schmid:
>>>
>>>http://imagej.1557.n6.nabble.**com/fft-maxima-td3682605.html<http://imagej.1557.n6.nabble.com/fft-maxima-td3682605.html>
>>>  It seems that analyzing the FFT (from the window) is not a good idea (can
>>>  anyone confirm this?). So I calculated the raw Power Spectrum, but I get a
>>>  almost complete black image. I experimented with this a little, for
>>>  example
>>>  by subtracting (size^2) from the pixel values and applying a Math>Log. But
>>>  there doesn't seem to change much...
>>>
>>>  Can someone help me with this problem? A brief explanation of how this is
>>>  usually done would be very helpful!
>>>  Also it is not completely clear to me how I calculate the square size in
>>>  pixels (px) from the FFT (or Power Spectrum).
>>>
>>>  Thanks in advance!
>>>
>>>  Best,
>>>
>>>  Tom
>>>
>>
>>
>>  Tom,
>>
>>  no problem here.
>>
>>  You may try to take the 4th square root of the Power Spectrum.
>>  Yes, and don't forget to reset in the "Brightnness/Contrast"-Window.
>>
>>  HTH
>>
>>                   Herbie
>>
>>          ------------------------
>>          <http://www.gluender.de>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

verified.human
In reply to this post by verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Herbie-6
Dear,

not sure what you want to achieve by Fourier-transforming your image.

You write that

        "The peak in the power spectrum that is closest to the center has a
        distance of ~40 pixels to the center of the PS."

but I neither can confirm this, nor would the closest peak give you
any information about the finest grid, i.e. the corresponding spatial
frequency.

A closer look at your image reveals that at least the spectral
information about the coarsest grid is well hidden in low frequency
components caused by fluctuations in your image of similar periods.
It should be observed at about 4 pixels from the spectral origin. For
the next finer grid, a peak at about 20 pixels is to be expected but
hardly to detect.

In short, there is not enough "energy" in the grid lines to reliably
detect their periods in the Fourier spectrum.

As far as Fourier-transformation and especially FFT is concerned, you
may consult a good text book dealing with these topics. The idea of
Fourier-transformation is quite simple but its proper use is
sometimes rather involved.

Best

                   Herbie

          ------------------------
          <http://www.gluender.de>

>Oke, thanks!
>But how do you come from 40px in the FD to 25.6px in the SD?
>
>gr,
>
>Tom
>
>
>2012/2/27 Herbie <[hidden email]>
>
>>  Dear,
>>
>>  as far as I measure, the smallest line distance is about 26 pixels. This
>>  fits nicely with your spectral peak-distance of 40 which corresponds to
>>  25.6 pixels in the spatial domain.
>>
>  >                  Herbie
>>
>>          ------------------------
>>          <http://www.gluender.de>
>>
>>
>>   Thanks guys!
>>>
>>>  Applying gamma corrections or taking the nth order square root works!
>>>  See:
>>>http://tweakers.net/ext/f/**V05DVyciM7s0LIAtvfA7CRfR/full.**png<http://tweakers.net/ext/f/V05DVyciM7s0LIAtvfA7CRfR/full.png>
>>>
>>>  Now the only question that remains is how I calculate the size of the
>>>  (smallest) squares of the grid in pixels.
>>>  When I measure the size in the original image this is approximately 52
>  >> pixels. The peak in the power spectrum that is closest to the center has a
>  >> distance of ~40 pixels to the center of the PS.
>>>
>>>  gr,
>>>
>>>  Tom
>>>
>>>
>>>  2012/2/27 Herbie <[hidden email]>
>>>
>>>    Hi everybody,
>>>>
>>>>>
>>>>>   I am trying to automatically detect the grid size of counting chambers:
>>>>>
>>>>>
>>>>>http://tweakers.net/ext/f/****qxSACpwr36khxQfNC0hlqqGO/full.****png<http://tweakers.net/ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png>
>>>>>
>>>>><http://tweakers.net/ext/**f/qxSACpwr36khxQfNC0hlqqGO/**full.png<http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png>
>>>>>  >
>>>>>
>>>>>   My idea was to do this by applying the following steps:
>>>>>
>>>>>   1) Crop the image to square size
>>>>>   2) Calculate the MEAN of the image and subtract this value from all
>>>>>  pixel
>>>>>   values
>>>>>   3) Calculate the FFT
>>>>>   4) Find the maxima locations close to the center of the FFT and use the
>>>>>   distance to the center to calculate the distance in pixels
>>>>>
>>>>>   I am now stuck at step (4)...When I was searching how to do this I
>>>>>   stumbled
>>>>>   upon this post of Michael Schmid:
>>>>>
>>>>>  http://imagej.1557.n6.nabble.****com/fft-maxima-td3682605.**html<
>>>>>
>>>>>http://imagej.1557.n6.**nabble.com/fft-maxima-**td3682605.html<http://imagej.1557.n6.nabble.com/fft-maxima-td3682605.html>
>>>>>  >
>>>>>
>>>>>   It seems that analyzing the FFT (from the window) is not a good idea
>>>>>  (can
>>>>>   anyone confirm this?). So I calculated the raw Power Spectrum, but I
>>>>>  get a
>>>>>   almost complete black image. I experimented with this a little, for
>>>>>   example
>>>>>   by subtracting (size^2) from the pixel values and applying a Math>Log.
>>>>>  But
>>>>>   there doesn't seem to change much...
>>>>>
>>>>>   Can someone help me with this problem? A brief explanation of how this
>>>>>  is
>>>>>   usually done would be very helpful!
>>>>>   Also it is not completely clear to me how I calculate the square size
>>>>>  in
>>>>>   pixels (px) from the FFT (or Power Spectrum).
>  >>>>
>>>>>   Thanks in advance!
>>>>>
>>>>>   Best,
>>>>>
>>>>>   Tom
>>>>>
>>>>>
>>>>
>>>>   Tom,
>>>>
>>>>   no problem here.
>>>>
>>>>   You may try to take the 4th square root of the Power Spectrum.
>>>>   Yes, and don't forget to reset in the "Brightnness/Contrast"-Window.
>>>>
>>>>   HTH
>>>>
>>>>                   Herbie
>>>>
>>>>          ------------------------
>>>>          <http://www.gluender.de>
>>>>
>>>>


--

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

verified.human
In reply to this post by verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Herbie-6
Funny you,

sending an image to the list with a question for analysis and now you write

>Never mind my images!
>
>I have some knowledge about Fourier Transforms (undergraduate course), but
>I just don't know how to translate a peak in the power spectrum back to a
>distance in the spatial domain.

If so, you will find the answer in your course notes.
Furthermore I gave you three examples, from which you may conclude
the answer to your question.

>I was hoping the ImageJ user manual would
>briefly describe how to do it, but unfortunately it does not mention it.

Of course the manuals deal with the IJ-program not with properties of the FFT.

>In the documentation of DIPimage, the image analysis toolkit for MatLAB I
>found the formula:
>
>*delta_FD = 1 / (delta_SD * N)*

In fact, this doesn't make sense but I think you didn't read carefully.

>delta_FD = distance in the Fourier Domain
>delta_SD = distance in the Spatial Domain
>N = width of the image in pixels
>
>But applying this formula does not lead me to anything. Can anyone
>recommend a website/source where I can find some information about this?
>Thanks!
>
>gr,
>
>Tom

For the FFT holds:
The borders of the frequency plane (with the origin in the center)
evidently are the Nyquist frequency
        f_N = f_0/2
i.e. half the sampling frequnecy f_0. From this we obtain that the
pixel to pixel spacing in the spatial domain is
        X = 1/f_0 = 2 * f_N;
Now set X = 1 and f_0 = n, where n is the image size.
With the rule of three you get
        1/1 corresponds to n
        1/x corresponds to f
where x is the _period_ (not a distance!)) in the space domain and f
is the location (in spectral pixels) of the corresponding spectral
component with respect to the origin.

HTH

                   Herbie

          ------------------------
          <http://www.gluender.de>

>2012/2/28 Herbie <[hidden email]>
>
>>  Dear,
>>
>>  not sure what you want to achieve by Fourier-transforming your image.
>>
>>  You write that
>>
>>
>>         "The peak in the power spectrum that is closest to the center has a
>>         distance of ~40 pixels to the center of the PS."
>>
>>  but I neither can confirm this, nor would the closest peak give you any
>>  information about the finest grid, i.e. the corresponding spatial frequency.
>>
>>  A closer look at your image reveals that at least the spectral information
>>  about the coarsest grid is well hidden in low frequency components caused
>>  by fluctuations in your image of similar periods. It should be observed at
>>  about 4 pixels from the spectral origin. For the next finer grid, a peak at
>>  about 20 pixels is to be expected but hardly to detect.
>>
>>  In short, there is not enough "energy" in the grid lines to reliably
>>  detect their periods in the Fourier spectrum.
>>
>>  As far as Fourier-transformation and especially FFT is concerned, you may
>>  consult a good text book dealing with these topics. The idea of
>>  Fourier-transformation is quite simple but its proper use is sometimes
>>  rather involved.
>>
>>  Best
>>
>>                   Herbie
>>
>>          ------------------------
>>          <http://www.gluender.de>
>>
>>   Oke, thanks!
>>>  But how do you come from 40px in the FD to 25.6px in the SD?
>>>
>>>  gr,
>>>
>>>  Tom
>>>
>>>
>>>  2012/2/27 Herbie <[hidden email]>
>>>
>>>    Dear,
>>>>
>>>>   as far as I measure, the smallest line distance is about 26 pixels. This
>>>>   fits nicely with your spectral peak-distance of 40 which corresponds to
>>>>   25.6 pixels in the spatial domain.
>>>>
>>>>    >                  Herbie
>>>
>>>>
>>>>          ------------------------
>>>>          <http://www.gluender.de>
>>>>
>>>>
>>>>   Thanks guys!
>>>>
>>>>>
>>>>>   Applying gamma corrections or taking the nth order square root works!
>>>>>   See: http://tweakers.net/ext/f/****V05DVyciM7s0LIAtvfA7CRfR/full.**
>>>>>  **png <http://tweakers.net/ext/f/**V05DVyciM7s0LIAtvfA7CRfR/full.**png>
>>>>>
>>>>><http://tweakers.net/ext/**f/V05DVyciM7s0LIAtvfA7CRfR/**full.png<http://tweakers.net/ext/f/V05DVyciM7s0LIAtvfA7CRfR/full.png>
>>>>>  >
>>>>>
>>>>>
>  >>>>  Now the only question that remains is how I calculate the size of the
>>>>>   (smallest) squares of the grid in pixels.
>>>>>   When I measure the size in the original image this is approximately 52
>>>>>
>>>>   >> pixels. The peak in the power spectrum that is closest to the center
>>>  has a
>>>   >> distance of ~40 pixels to the center of the PS.
>>>
>>>>
>>>>>   gr,
>>>>>
>>>>>   Tom
>>>>>
>>>>>
>>>>>   2012/2/27 Herbie <[hidden email]>
>>>>>
>>>>>    Hi everybody,
>>>>>
>>>>>>
>>>>>>
>>>>>>>   I am trying to automatically detect the grid size of counting
>>>>>>>  chambers:
>>>>>>>
>>>>>>>
>>>>>>>  http://tweakers.net/ext/f/******qxSACpwr36khxQfNC0hlqqGO/full.**
>>>>>>>
>>>>>>>****png<http://tweakers.net/ext/f/****qxSACpwr36khxQfNC0hlqqGO/full.****png>
>>>>>>>  <http://tweakers.net/**ext/f/****qxSACpwr36khxQfNC0hlqqGO/full.**
>>>>>>>  **png<http://tweakers.net/ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png>
>>>>>>>  >
>>>>>>>
>>>>>>>
>>>>>>><http://tweakers.net/ext/**f/**qxSACpwr36khxQfNC0hlqqGO/****full.png<http://tweakers.net/ext/**f/qxSACpwr36khxQfNC0hlqqGO/**full.png>
>>>>>>>
>>>>>>><http://tweakers.net/**ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png<http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png>
>>>>>>>  >
>>>>>>>
>>>>>>>   >
>>>>>>>
>>>>>>>   My idea was to do this by applying the following steps:
>>>>>>>
>>>>>>>   1) Crop the image to square size
>>>>>>>   2) Calculate the MEAN of the image and subtract this value from all
>>>>>>>   pixel
>>>>>>>   values
>>>>>>>   3) Calculate the FFT
>>>>>>>   4) Find the maxima locations close to the center of the FFT and use
>>>>>>>  the
>>>>>>>   distance to the center to calculate the distance in pixels
>>>>>>>
>>>>>>>   I am now stuck at step (4)...When I was searching how to do this I
>>>>>>>   stumbled
>>>>>>>   upon this post of Michael Schmid:
>>>>>>>
>>>>>>>   http://imagej.1557.n6.nabble.******com/fft-maxima-td3682605.****
>>>>>>>  html<
>>>>>>>
>>>>>>>
>>>>>>>http://imagej.1557.n6.**nabble**.com/fft-maxima-**td3682605.**html<http://nabble.com/fft-maxima-**td3682605.html>
>>>>>>>
>>>>>>><http://imagej.1557.n6.**nabble.com/fft-maxima-**td3682605.html<http://imagej.1557.n6.nabble.com/fft-maxima-td3682605.html>
>>>>>>>  >
>>>>>>>
>>>>>>>   >
>>>>>>>
>>>>>>>   It seems that analyzing the FFT (from the window) is not a good idea
>>>>>>>   (can
>>>>>>>   anyone confirm this?). So I calculated the raw Power Spectrum, but I
>>>>>>>   get a
>>>>>>>   almost complete black image. I experimented with this a little, for
>>>>>>>   example
>>>>>>>   by subtracting (size^2) from the pixel values and applying a
>>>>>>>  Math>Log.
>>>>>>>   But
>>>>>>>   there doesn't seem to change much...
>>>>>>>
>>>>>>>   Can someone help me with this problem? A brief explanation of how
>>>>>>>  this
>>>>>>>   is
>>>>>>>   usually done would be very helpful!
>>>>>>>   Also it is not completely clear to me how I calculate the square size
>>>>>>>   in
>>>>>>>   pixels (px) from the FFT (or Power Spectrum).
>>>>>>>
>>>>>>   >>>>
>>>
>>>>    Thanks in advance!
>>>>>>>
>>>>>>>   Best,
>>>>>>>
>>>>>>>   Tom
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>   Tom,
>>>>>>
>>>>>>   no problem here.
>>>>>>
>>>>>>   You may try to take the 4th square root of the Power Spectrum.
>>>>>>   Yes, and don't forget to reset in the "Brightnness/Contrast"-Window.
>>>>>>
>>>>>>   HTH
>>>>>>
>>>>>>                   Herbie
>>>>>>
>>>>>>          ------------------------
>>>>>>          <http://www.gluender.de>
>>>>>>
>>>>>>
>>>>>>
>>
>>  --
>>
>>                   Herbie
>>
>>          ------------------------
>>          <http://www.gluender.de>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

Herbie-6
Should read: X = 1/f_0 = 1/(2 * f_N);

>Funny you,
>
>sending an image to the list with a question for analysis and now you write
>
>>Never mind my images!
>>
>>I have some knowledge about Fourier Transforms (undergraduate course), but
>>I just don't know how to translate a peak in the power spectrum back to a
>>distance in the spatial domain.
>
>If so, you will find the answer in your course notes.
>Furthermore I gave you three examples, from which you may conclude
>the answer to your question.
>
>>I was hoping the ImageJ user manual would
>>briefly describe how to do it, but unfortunately it does not mention it.
>
>Of course the manuals deal with the IJ-program not with properties of the FFT.
>
>>In the documentation of DIPimage, the image analysis toolkit for MatLAB I
>>found the formula:
>>
>>*delta_FD = 1 / (delta_SD * N)*
>
>In fact, this doesn't make sense but I think you didn't read carefully.
>
>>delta_FD = distance in the Fourier Domain
>>delta_SD = distance in the Spatial Domain
>>N = width of the image in pixels
>>
>>But applying this formula does not lead me to anything. Can anyone
>>recommend a website/source where I can find some information about this?
>>Thanks!
>>
>>gr,
>>
>>Tom
>
>For the FFT holds:
>The borders of the frequency plane (with the origin in the center)
>evidently are the Nyquist frequency
> f_N = f_0/2
>i.e. half the sampling frequnecy f_0. From this we obtain that the
>pixel to pixel spacing in the spatial domain is
> X = 1/f_0 = 2 * f_N;
>Now set X = 1 and f_0 = n, where n is the image size.
>With the rule of three you get
> 1/1 corresponds to n
> 1/x corresponds to f
>where x is the _period_ (not a distance!)) in the space domain and f
>is the location (in spectral pixels) of the corresponding spectral
>component with respect to the origin.
>
>HTH
>
>                   Herbie
>
>          ------------------------
>          <http://www.gluender.de>
>
>>2012/2/28 Herbie <[hidden email]>
>>
>>>  Dear,
>>>
>>>  not sure what you want to achieve by Fourier-transforming your image.
>>>
>>>  You write that
>>>
>>>
>>>         "The peak in the power spectrum that is closest to the center has a
>>>         distance of ~40 pixels to the center of the PS."
>>>
>>>  but I neither can confirm this, nor would the closest peak give you any
>>>  information about the finest grid, i.e. the corresponding spatial
>>>frequency.
>>>
>>>  A closer look at your image reveals that at least the spectral information
>>>  about the coarsest grid is well hidden in low frequency components caused
>>>  by fluctuations in your image of similar periods. It should be observed at
>>>  about 4 pixels from the spectral origin. For the next finer grid, a peak at
>>>  about 20 pixels is to be expected but hardly to detect.
>>>
>>>  In short, there is not enough "energy" in the grid lines to reliably
>>>  detect their periods in the Fourier spectrum.
>>>
>>>  As far as Fourier-transformation and especially FFT is concerned, you may
>>>  consult a good text book dealing with these topics. The idea of
>>>  Fourier-transformation is quite simple but its proper use is sometimes
>>>  rather involved.
>>>
>>>  Best
>>>
>>>                   Herbie
>>>
>>>          ------------------------
>>>          <http://www.gluender.de>
>>>
>>>   Oke, thanks!
>>>>  But how do you come from 40px in the FD to 25.6px in the SD?
>>>>
>>>>  gr,
>>>>
>>>>  Tom
>>>>
>>>>
>>>>  2012/2/27 Herbie <[hidden email]>
>>>>
>>>>    Dear,
>>>>>
>>>>>   as far as I measure, the smallest line distance is about 26 pixels. This
>>>>>   fits nicely with your spectral peak-distance of 40 which corresponds to
>>>>>   25.6 pixels in the spatial domain.
>>>>>
>>>>>    >                  Herbie
>>>>
>>>>>
>>>>>          ------------------------
>>>>>          <http://www.gluender.de>
>>>>>
>>>>>
>>>>>   Thanks guys!
>>>>>
>>>>>>
>>>>>>   Applying gamma corrections or taking the nth order square root works!
>>>>>>   See: http://tweakers.net/ext/f/****V05DVyciM7s0LIAtvfA7CRfR/full.**
>>>>>>  **png <http://tweakers.net/ext/f/**V05DVyciM7s0LIAtvfA7CRfR/full.**png>
>>>>>>
>>>>>><http://tweakers.net/ext/**f/V05DVyciM7s0LIAtvfA7CRfR/**full.png<http://tweakers.net/ext/f/V05DVyciM7s0LIAtvfA7CRfR/full.png>
>>>>>>  >
>>>>>>
>>  >>>>  Now the only question that remains is how I calculate the size of the
>>>>>>   (smallest) squares of the grid in pixels.
>>>>>>   When I measure the size in the original image this is approximately 52
>>>>>>
>>>>>   >> pixels. The peak in the power spectrum that is closest to the center
>>>>  has a
>>>>   >> distance of ~40 pixels to the center of the PS.
>>>>
>>>>>
>>>>>>   gr,
>>>>>>
>>>>>>   Tom
>>>>>>
>>>>>>
>>>>>>   2012/2/27 Herbie <[hidden email]>
>>>>>>
>>>>>>    Hi everybody,
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>   I am trying to automatically detect the grid size of counting
>>>>>>>>  chambers:
>>>>>>>>
>>>>>>>>
>>>>>>>>  http://tweakers.net/ext/f/******qxSACpwr36khxQfNC0hlqqGO/full.**
>>>>>>>>
>>>>>>>>****png<http://tweakers.net/ext/f/****qxSACpwr36khxQfNC0hlqqGO/full.****png>
>>>>>>>>  <http://tweakers.net/**ext/f/****qxSACpwr36khxQfNC0hlqqGO/full.**
>>>>>>>>  **png<http://tweakers.net/ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png>
>>>>>>>>  >
>>>>>>>>
>>>>>>>>
>>>>>>>><http://tweakers.net/ext/**f/**qxSACpwr36khxQfNC0hlqqGO/****full.png<http://tweakers.net/ext/**f/qxSACpwr36khxQfNC0hlqqGO/**full.png>
>>>>>>>>
>>>>>>>><http://tweakers.net/**ext/f/**qxSACpwr36khxQfNC0hlqqGO/full.**png<http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png>
>>>>>>>>  >
>>>>>>>>
>>>>>>>>   >
>>>>>>>>
>>>>>>>>   My idea was to do this by applying the following steps:
>>>>>>>>
>>>>>>>>   1) Crop the image to square size
>>>>>>>>   2) Calculate the MEAN of the image and subtract this value from all
>>>>>>>>   pixel
>>>>>>>>   values
>>>>>>>>   3) Calculate the FFT
>>>>>>>>   4) Find the maxima locations close to the center of the FFT and use
>>>>>>>>  the
>>>>>>>>   distance to the center to calculate the distance in pixels
>>>>>>>>
>>>>>>>>   I am now stuck at step (4)...When I was searching how to do this I
>>>>>>>>   stumbled
>>>>>>>>   upon this post of Michael Schmid:
>>>>>>>>
>>>>>>>>   http://imagej.1557.n6.nabble.******com/fft-maxima-td3682605.****
>>>>>>>>  html<
>>>>>>>>
>>>>>>>>
>>>>>>>>http://imagej.1557.n6.**nabble**.com/fft-maxima-**td3682605.**html<http://nabble.com/fft-maxima-**td3682605.html>
>>>>>>>>
>>>>>>>><http://imagej.1557.n6.**nabble.com/fft-maxima-**td3682605.html<http://imagej.1557.n6.nabble.com/fft-maxima-td3682605.html>
>>>>>>>>  >
>>>>>>>>
>>>>>>>>   >
>>>>>>>>
>>>>>>>>   It seems that analyzing the FFT (from the window) is not a good idea
>>>>>>>>   (can
>>>>>>>>   anyone confirm this?). So I calculated the raw Power Spectrum, but I
>>>>>>>>   get a
>>>>>>>>   almost complete black image. I experimented with this a little, for
>>>>>>>>   example
>>>>>>>>   by subtracting (size^2) from the pixel values and applying a
>>>>>>>>  Math>Log.
>>>>>>>>   But
>>>>>>>>   there doesn't seem to change much...
>>>>>>>>
>>>>>>>>   Can someone help me with this problem? A brief explanation of how
>>>>>>>>  this
>>>>>>>>   is
>>>>>>>>   usually done would be very helpful!
>>>>>>>>   Also it is not completely clear to me how I calculate the square size
>>>>>>>>   in
>>>>>>>>   pixels (px) from the FFT (or Power Spectrum).
>>>>>>>>
>>>>>>>   >>>>
>>>>
>>>>>    Thanks in advance!
>>>>>>>>
>>>>>>>>   Best,
>>>>>>>>
>>>>>>>>   Tom
>>>>>>>>
>>>>>>>>
>>>>>>>   Tom,
>>>>>>>
>>>>>>>   no problem here.
>>>>>>>
>>>>>>>   You may try to take the 4th square root of the Power Spectrum.
>>>>>>>   Yes, and don't forget to reset in the "Brightnness/Contrast"-Window.
>>>>>>>
>>>>>>>   HTH
>>>>>>>
>>>>>>>                   Herbie
>>>>>>>
>>>>>>>          ------------------------
>>>>>>>          <http://www.gluender.de>
>>>>>>>
>>>>>>>
>>>
>>>  --
>>>
>>>                   Herbie
>>>
>>>          ------------------------
>>>          <http://www.gluender.de>


--

                   Herbie

          ------------------------
          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid size by using the FFT

verified.human
In reply to this post by verified.human
CONTENTS DELETED
The author has deleted this message.