Find Image Extrema

버전 1.0.0.0 (2.55 KB) 작성자: Tristan Ursell
Find local maxima, local minima, saddle points, and flat regions in an image.
다운로드 수: 1.4K
업데이트 날짜: 2013/5/28

라이선스 보기

Tristan Ursell
Image Extrema Finder
May 2013

[x,y,z,c]=imextrema(im1);
[x,y,z,c]=imextrema(im1,hood);

Estimate extrema in an image at pixel resolution. The input image 'im1'
is a grayscale image of any class. The outputs 'x' and 'y' specify the%pixel positions of the extrema, 'z' specifies the value of the image at
the extrema positions, and 'c' classifies the extrema, with:

c = -1 --> local minimum
c = 0 --> saddle point
c = +1 --> local maximum
c = +2 --> locally flat / extrema undefined

The optional variable 'hood' specifies the topology of the pixel
neighborhood used to find extrema, the options are hood = 4 or hood = 8,
8 is the default.

Some extrema may not be mathematically defined at a single point, i.e. in
the example below the saddle points come in pixel doublets -- this is a
property of image discretization, not an issue with the algorithm.

Image extrema can not occur on the image edge.

If noise is an issue you might consider smoothing the input image with a
Gaussian blur filter or a hmin (matlab: imhmin) transform.

The algorithm will not find ridge lines.

EXAMPLE 1:
dx=500;
Xpos=ones(dx,1)*(1:dx);
Ypos=Xpos';
Im1=cos(4*pi*Xpos/dx).*cos(6*pi*Ypos/dx)+5*((Xpos-dx/2).^2/dx^2+(Ypos-dx/2).^2/dx^2);
Im1(Im1<-0.9)=-0.9;

[x,y,z,c]=imextrema(Im1);

figure
hold on
imagesc(Im1)
plot(x(c==1),y(c==1),'w.')
plot(x(c==-1),y(c==-1),'k.')
plot(x(c==0),y(c==0),'kx')
plot(x(c==2),y(c==2),'wx')
axis equal tight
title(['white dots = maxima, black dots = minima, black x = saddles, white x = flat'])

EXAMPLE 2:
Im1=imread('rice.png');
Im1(Im1<100)=0;

[x,y,z,c]=imextrema(Im1);

figure
hold on
imagesc(Im1)
plot(x(c==1),y(c==1),'rx')
axis equal tight
title(['red x = maxima'])
colormap(gray)

인용 양식

Tristan Ursell (2024). Find Image Extrema (https://www.mathworks.com/matlabcentral/fileexchange/41955-find-image-extrema), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0