如何使用matlab查找图像中的峰值?

如何使用matlab查找图像中的峰值?,matlab,Matlab,我试图勾勒出图像中的所有山峰。最亮的线条是山峰。我正在使用Matlab。这就是我目前所拥有的。。。。 任何帮助都将不胜感激。这是图片 a = imread('duneLiDARs.png'); %b = imregionalmax(a); %a = rgb2gray(a); c = edge(a,'Sobel'); b = edge(a,'log',.0006); d = edge(a,'log'); c= imfuse(a,d); d= d-b; subplot(2,2,1), imshow

我试图勾勒出图像中的所有山峰。最亮的线条是山峰。我正在使用Matlab。这就是我目前所拥有的。。。。 任何帮助都将不胜感激。这是图片

a = imread('duneLiDARs.png');
%b = imregionalmax(a);
%a = rgb2gray(a);
c = edge(a,'Sobel');
b = edge(a,'log',.0006);
d = edge(a,'log');
c= imfuse(a,d);
d= d-b;

subplot(2,2,1), imshow(a)
subplot(2,2,2), imshow(b)
subplot(2,2,3), imshow(c)
subplot(2,2,4), imshow(d)
%imshow(b);
%c = imadd(a,b);
%imshow(b);


你需要定义你认为什么是峰值——你想要的图像输出是什么?

但是,有一些通用的2D峰值查找功能,以下代码使用:

%加载图像并移除极端噪声
im=medfilt2(im2double(imread('dune.png'));
%使用极值2查找峰值
[XMAX,IMAX,XMIN,IMIN]=extrema2(im);
%消除最小阈值下的峰值
欠阈值=XMAX<0.15;
IMAX(欠阈值)=[];
XMAX(欠阈值)=[];
%策划
小批(121);
冲浪(im,'EdgeColor','none');
等等
[y,x]=ind2sub(大小(im),IMAX);
散射体3(x,y,XMAX,'r','filled');
轴线广场
小批(122);
imshow(im,[]);
等等
散射(x,y,'r','filled');

如何定义峰值?周围没有值的点是Brigger吗?
% load image and remove extreme noise
im = medfilt2(  im2double(imread('dune.png')));
% find peaks using extrema2
[XMAX,IMAX,XMIN,IMIN] = extrema2(im);
% eliminate peaks under minimum threshold
underThresh = XMAX < 0.15;
IMAX(underThresh) = [];
XMAX(underThresh) = [];
% plotting
subplot(121);
surf(im,'EdgeColor','none');
hold on;
[y,x] = ind2sub(size(im),IMAX);
scatter3(x,y,XMAX,'r','filled');
axis square
subplot(122);
imshow(im,[]);
hold on;
scatter(x,y,'r','filled');