function h = mmpatspec( f, type, n ) % MMPATSPEC Pattern spectrum (also known as granulometric size density). % % H = MMPATSPEC( F, TYPE, N ) % % Input: % F - Binary image (logical uint8). % TYPE - String. Disk family: 'OCTAGON', 'CHESSBOARD', 'CITY-BLOCK', % 'LINEAR-V', LINEAR-H'. DEFAULT: 'OCTAGON'. % N - Maximum disk radius. DEFAULT: 65535. % % Output: % H - Gray-scale (uint8 or uint16) or binary image (logical uint8). % a UINT16 column vector. % % Compute the Pattern Spectrum of a binary image. See [Mar89] % (See MMBIBLIO)] . % % Examples % -------- % % f = logical(uint8([... % 0 0 0 0 0 0 0;... % 0 1 1 1 1 0 0;... % 0 1 1 1 1 1 0;... % 0 1 1 1 1 0 0;... % 0 0 0 0 0 0 0])); % mmpatspec( f, 'city-block')' % % % % f=imread('numbers.tif'); % fr = mmlabel(f); % obj1=mmcmp(fr,'==', uint16(1)); % obj2=mmcmp(fr,'==',uint16(2)); % obj3=mmcmp(fr,'==',uint16(3)); % mmshow(obj1); % mmshow(obj2); % mmshow(obj3); % h1 = mmpatspec( obj1,'OCTAGON')' % h2 = mmpatspec( obj2, 'OCTAGON')' % h3 = mmpatspec( obj3, 'OCTAGON')' % % stem(h1); % axis([0 5 0 400]); % showfig(h1); % stem(h2); % axis([0 5 0 400]); % showfig(h2); % stem(h3); % axis([0 5 0 400]); % showfig(h3); % % See also MMOPEN, MMOPENTRANSF, MMSEDISK. % begin of the default argument automatic treatment if ~exist('type','var') type = 'OCTAGON'; end if ~exist('n','var') n = 65535; end % end of the default argument automatic treatment 1 if (nargin == 0 | nargin > 3) disp('Error: 1, 2 or 3 input parameters'); return; end if ~mmisbinary(f) disp('Error: input image is not binary'); return; end g=mmopentransf(f,type,n); h=mmhistogram(g); h=h(2:end); % Copyright (c) 1998-2001 by SDC Information Systems.