COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### finding the second peak of 2D spectrum

• Follow

```hi all

i would like to find the second peak of the fft2 output (2D).... i'm finding the max peak by using z = max(max(x));

thanks
```
 0

```Ahmad Alkandri wrote:

> i would like to find the second peak of the fft2 output (2D).... i'm
> finding the max peak by using z = max(max(x));

One way:

z = max(max(x));
x(find(x(:)==z,1,'first') = -inf;
z2 = max(max(x));

Another way:

xs = sort(x(:),'descend');
z = xs(1);
z2 = xs(2);
```
 0

```That would find the second highest value, which may lie on the first
(highest) peak if the peak is broad.

Often with FFT's of periodic functions, you'll still have a big fat
noisy peak around the origin (DC) and periodic much smaller peaks out
away from the origin.  And you'd like to ignore that big central peak
and just consider the smaller peaks.

This is not such an easy question to answer because it's not always
clear where the first peak "ends" especially if it's not symmetrical
and has noise on it.  A big noisy peak could have several much smaller
peaks on the side of it that you'd like to ignore.  The problem in 2D
is much harder than finding peaks in 1D signals.  You could try
imextendedmax(), imhmax(), or imregionalmax(), all in the Image
Processing Toolbox.  I've only briefly tried these so I can't really
help with them.

Finally, you could try an algorithm used in astronomy to find stars.
It's called the CLEAN algorithm.
http://www.cv.nrao.edu/~abridle/deconvol/deconvol.html
Basically it finds the biggest peak, and models that peak as a
Gaussian.  Then, it adds the Gaussian model peak to an output image,
subtracts it from the input image, and repeats until the volume of
remaining peaks in the input image is smaller than what you specify.
Makes sense if you think about it.
-ImageAnalyst
```
 0

```hi

thanks all for the replay ... i have tested the codes by Walter Roberson and the result was as suggested by ImageAnalyst  .... this is really what i need the max two peaks on the correlation plan when both peaks are thick around the DC .... i will try and if there is any help i will be glad

```
 0

3 Replies
374 Views

Similiar Articles:

7/20/2012 7:45:26 AM