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

📄 bwarea.m

📁 有关matlab的电子书籍有一定的帮助希望有用
💻 M
字号:
function a = bwarea(b)
%BWAREA Compute the area of objects in binary image.
%   TOTAL = BWAREA(BW) estimates the area of the objects in
%   binary image BW. TOTAL is a scalar whose value corresponds
%   roughly to the total number of "on" pixels in the image, but
%   may not be exactly the same because different patterns of
%   pixels are weighted differently.
%
%   Class Support
%   -------------
%   BW can be of class uint8 or double. TOTAL is of class
%   double.
%
%   Example
%   -------
%       BW = imread('circles.tif');
%       imshow(BW)
%       bwarea(BW)
%
%   See also BWPERIM, BWEULER.

%   Clay M. Thompson 11-17-92
%   Revised Steven L. Eddins, 1996
%   Copyright 1993-1998 The MathWorks, Inc.  All Rights Reserved.
%   $Revision: 5.8 $  $Date: 1997/11/24 15:34:04 $

% Reference: William Pratt, Digital Image Processing, John Wiley
% and Sons, 1991, pp. 630-634.

lut = [0     2     2     4     2     4     6     7     2     6     4     7 ...
       4     7     7     8];

% Need to zero-pad the input.
bb = repmat(uint8(0),size(b)+2);
bb(2:end-1,2:end-1) = b;

weights = applylut(bb,lut);
a = sum(weights(:))/8;

⌨️ 快捷键说明

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