Frage

Was ist die beste Methode, um Impulspeaks (Dirac Delta) in einer 2D -Matrix zu finden?

Insbesondere möchte ich die harmonischen Frequenzen eines bestimmten Bildes finden, und daher muss ich Impulspeaks im Bild Absolutwert DFT finden.

Ich dachte daran, FindPeaks zu verwenden, aber es gibt keine 2D -Version. Ich habe auch frühere Beiträge zum Auffinden gewöhnlicher Peaks mit Imdilat und/oder iMextendedMax gesehen, aber diese finden alle Peaks in einer 2D -Matrix, während ich nur an Impulspeaks interessiert bin. Ich bin sicher, DSP -Leute haben ein gemeinsames Rezept dafür ...

Bitte helfen Sie,

Vielen Dank

War es hilfreich?

Lösung

What you want to do is find peaks with high contrast. Thus, you need a way to identify local maxima, plus a way to measure the difference between the peak and the surrounding values. Thresholding on this difference will identify the impulse peaks for you.

Assuming your input signal is called signal

%# dilate to find, for every pixel, the maximum of its neighbors
dilationMask = ones(3);
dilationMask(5) = 0;
dilSignal = imdilate(signal, dilationMask);

%# find all peaks
%# peaks = signal > dilSignal;

%# find large peaks peaks by thresholding, i.e. you accept a peak only 
%# if it's more than 'threshold' higher than its neighbors
peaks = (signal - dilSignal) > threshold;

peaks is a logical array with 1's wherever there is a good peak. You can use it to read peak heights from signal with signal(peaks), and to find coordinates using find(peaks).

Andere Tipps

This paper I wrote contains Matlab source code for fast local peak detection in 2D. It works similar to imregionalmax() in Mathworks Image Processing Toolbox but allows you to specify a local neighborhood radius: bigger radius -> sparser peaks.

Since you expect sparse impulses, the nonmaxsupp_scanline() function may be suitable for you.

The findpeaks algorithm is pretty trivial; if an element is bigger than both its neighbours, then it is a peak. Writing a 2D version of this should be pretty simple.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top