function opened_image = open2( source_image, neighborhood ); % OPEN2 open a greyscale image. % usage: % central = imread('central.bmp'); % c = circle(11); % ocentral = open2( central, c); % imagesc(ocentral); % colormap(gray(64)); % assumes source_image is a array 0 = black, max(source_image)=white pixels; % assumes neighborhood is a array of 1 = neighbor pixels, 0 = non-neighbor pixels; % open(A,B) =def= erosion, followed by dilation. % Removes small bright particles and thin bright threads, % without changing most edges. % See also ERODE2, OPEN2, CLOSE2, DILATE. % Change log: % 1998-03-26:DAV: David Cary wrote. % see medfilt2() for median filtering. opened_image = dilate2( erode2( source_image, neighborhood ), neighborhood ); % end open2.m