【转】MATLAB求图像局部峰值点集
(2012-11-27 12:34:26)
标签:
matlab峰值点集it |
分类: MATLAB |
经过辛苦寻找,目前发现三种方法来做(其中alpha控制强度):
方法一:
I = imread('lena-gray.bmp');
%BW = nlfilter(I, [3 3], @(x) all(x(5) > x([1:4 6:9])+ alpha ) ); %方法1
imshow(BW);
This "find
strict max" function
would simply check if the center of the neighborhood is strictly
greater than all the other elements in that neighborhood, which is
always 3x3 for this purpose.
方法二:
I = imread('lena-gray.bmp');
%BW = imregionalmax(I);%方法2
imshow(BW);
方法三:
I = imread('lena-gray.bmp');
BW = I > imdilate(I, [1 1 1; 1 0 1; 1 1 1]) +alpha ; %方法3
imshow(BW);
@Nathan: IMDILATE operates on each pixel of the grayscale image. The center of the 3-by-3 matrix is positioned at each pixel, and the pixel value is replaced by the maximum value found at the neighboring pixels where there is a value of 1 in the 3-by-3 matrix. The call to IMDILATE therefore returns a new matrix where each point is replaced by the maximum value of its 8 neighbors (zero padded at the edges as needed), and the points where the original matrix is larger indicates a local maxima.
goes
over each pixel and computes the max of the neighboring pixels
centered around it and specified by the mask given (notice the zero
in the middle to exclude the pixel itself). Then we compare the
resulting image with the original to check whether each pixel is
strictly greater than the max of its neighborhood. Make sure to
read the documentation page on morphological
operations:
.
【转载】http://hi.baidu.com/lewutian
方法一:
I = imread('lena-gray.bmp');
%BW = nlfilter(I, [3 3], @(x) all(x(5) > x([1:4 6:9])+ alpha ) ); %方法1
imshow(BW);
This
方法二:
I = imread('lena-gray.bmp');
%BW = imregionalmax(I);%方法2
imshow(BW);
The variable BW y
NOTE: BW
CC
= bwconncomp(BW);
for i = 1:CC.NumObjects,
index = CC.PixelIdxList{i};
if (numel(index) > 1),
BW(index) = false;
end
end
方法三:
I = imread('lena-gray.bmp');
BW = I > imdilate(I, [1 1 1; 1 0 1; 1 1 1]) +alpha ; %方法3
imshow(BW);
@Nathan: IMDILATE operates on each pixel of the grayscale image. The center of the 3-by-3 matrix is positioned at each pixel, and the pixel value is replaced by the maximum value found at the neighboring pixels where there is a value of 1 in the 3-by-3 matrix. The call to IMDILATE therefore returns a new matrix where each point is replaced by the maximum value of its 8 neighbors (zero padded at the edges as needed), and the points where the original matrix is larger indicates a local maxima.
imdilate .
【转载】http://hi.baidu.com/lewutian

加载中…