Very fast 2D local maxima
Version 1.0.1 (2,1 KB) von
George Heath
Detects local maxima (peaks) in a 2D image above a specified intensity threshold, neighborhood, and optionally filters peaks by prominence
A very fast local maxima (peak detector) for 2D images using morphological maximum filtering. Ideal for video analysis when used in a loop.
User can define intensity threshold, local neighborhood and optionally filters peaks by prominence.
USAGE:
Example 1 (defult): locs = Fast_peaks2D(Img, thresh, kernel_size)
Example 2 (with prominence): locs = Fast_peaks2D(Img, thresh, kernel_size, min_prom)
Example 3 (for multiple frames):
locs = [];
for i = 1:numel(img(1,1,:))
li = Fast_peaks2D(img(:,:,i), LAFM_thresh, 1);
li = [li, i*ones(numel(li(:,1)),1)];
locs = [locs; li];
end
INPUTS:
Img - 2D image (grayscale, numeric matrix) for peak detection.
thresh - Intensity threshold; only peaks above this value are considered.
kernel_size - Size of the local neighborhood used for maximum filtering (in pixels).
min_prom - (Optional) Minimum required prominence of peaks. Peaks with lower prominence are discarded.
OUTPUT:
locs - Nx4 array where each row represents a detected peak:
[x_position, y_position, peak_height, prominence]
If min_prom is not provided, prominence is set to zero.
ISSUE: Over picks peaks on featureless or uniform regions
NOTES:
- The function uses morphological maximum filtering and optional prominence filtering.
- Edge pixels (within 2 pixels of the image boundary) are excluded from detection.
- Prominence is computed as the vertical distance to the lowest point along the path to the nearest higher neighboring peak. Prominence calculations slow the code down.
Zitieren als
George Heath (2026). Very fast 2D local maxima (https://de.mathworks.com/matlabcentral/fileexchange/181437-very-fast-2d-local-maxima), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2025a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxTags
Quellenangaben
Inspiriert von: NanoLocz - AFM Image Analysis Platform
Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
| Version | Veröffentlicht | Versionshinweise | |
|---|---|---|---|
| 1.0.1 | Improved description |
||
| 1.0.0 |
