سؤال

ما هي أفضل طريقة لإيجاد قمم الدافع (Dirac Delta) في مصفوفة ثنائية الأبعاد.

وبشكل أكثر تحديداً ، أود أن أجد الترددات التوافقية لصورة معينة ولذا أحتاج إلى العثور على قمم دافعة في القيمة المطلقة DFT.

فكرت في استخدام FindPeaks ولكن لا يوجد إصدار ثنائي الأبعاد. لقد رأيت أيضًا منشورات سابقة فيما يتعلق بإيجاد قمم عادية باستخدام imdilate و/أو imextendedMax ، لكن تلك التي تجد جميع القمم في مصفوفة ثنائية الأبعاد بينما أنا مهتم فقط بقمم الدافع. أنا متأكد من أن الناس DSP لديهم وصفة مشتركة لهذا ...

الرجاء المساعدة ،

شكرًا

هل كانت مفيدة؟

المحلول

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).

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top