⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bwperim.m

📁 有关matlab的电子书籍有一定的帮助希望有用
💻 M
字号:
function pout = bwperim(b,n)
%BWPERIM Determine perimeter of objects in binary image.
%   BW2 = BWPERIM(BW1,N) returns a binary image containing
%   only the perimeter pixels of objects in the input image BW1.
%   A pixel is part of the perimeter if its value is 1 and there
%   is at least one zero-valued pixel in its neighborhood.  N can
%   have a value of either 4 or 8, where 4 specifies 4-connected
%   neighborhoods and 8 specifies 8-connected neighborhoods; if
%   the argument if omitted, it defaults to 8.
%
%   Class Support
%   -------------
%   The input image BW1 can be of class double or uint8.  The
%   output image BW2 is of class uint8.
%
%   Example
%   -------
%       BW1 = imread('circbw.tif');
%       BW2 = bwperim(BW1,8);
%       imshow(BW1)
%       figure, imshow(BW2)
%
%   See also BWAREA, BWEULER, BWFILL.

%   Clay M. Thompson 11-17-92
%   Copyright 1993-1998 The MathWorks, Inc.  All Rights Reserved.
%   $Revision: 5.7 $  $Date: 1997/11/24 15:34:11 $

error(nargchk(1,2,nargin));

if nargin<2, n = 4; end

if n~=8 & n~=4, error('N must be either 4 or 8.'); end

if n==4,
  p = bwmorph(b,'perim4');
else
  p = bwmorph(b,'perim8');
end

if nargout==0, imshow(p,2), return, end
pout = p;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -