2017-04-24 71 views
1

我想勾勒出图像中的所有峰。最明亮的线条是峰顶。我正在使用Matlab。这是我到目前为止...... 任何帮助将不胜感激。这是图像。如何使用matlab在图像中找到峰值?

enter image description here

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); 
+1

你如何定义峰值?没有任何价值观是brigther? –

回答

1

你需要定义你有什么考虑为峰 - 什么是你的图像所需的输出。

但是,也有一些通用的2D峰发现功能,下面的代码使用FEX's extrema2

% 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'); 

enter image description here