This is a static copy of a profile report

Home

bwlabel (18589 calls, 8.982 sec)
Generated 05-Nov-2014 07:52:43 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/images/images/bwlabel.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
bwboundaries>FindObjectBoundariessubfunction1721
bwboundaries>FindHoleBoundariessubfunction1721
ml_findmainobj2d_bwfunction9089
ml_findmainobj_bwfunction6058
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
80
[startRow,endRow,startCol,labe...
185894.847 s54.0%
84
L = bwlabel2(startRow,endRow,s...
185891.041 s11.6%
77
BW = BW ~= 0;
121180.981 s10.9%
66
iptchecknargin(1,2,nargin,mfil...
185890.551 s6.1%
67
iptcheckinput(BW, {'logical' '...
185890.391 s4.3%
All other lines  1.172 s13.0%
Totals  8.982 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
images/private/labelBinaryRunsfunction185894.556 s50.7%
images/private/bwlabel2MEX-file185890.511 s5.7%
iptchecknarginfunction185890.210 s2.3%
iptcheckinputMEX-file371780.160 s1.8%
Self time (built-ins, overhead, etc.)  3.545 s39.5%
Totals  8.982 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function85
Non-code lines (comments, blank lines)72
Code lines (lines that can run)13
Code lines that did run12
Code lines that did not run1
Coverage (did run/can run)92.31 %
Function listing
   time   calls  line
1 function [L,numComponents] = bwlabel(BW,mode)
2 %BWLABEL Label connected components in 2-D binary image.
3 % L = BWLABEL(BW,N) returns a matrix L, of the same size as BW,
4 % containing labels for the connected components in BW. N can have a
5 % value of either 4 or 8, where 4 specifies 4-connected objects and 8
6 % specifies 8-connected objects; if the argument is omitted, it defaults
7 % to 8.
8 %
9 % The elements of L are integer values greater than or equal to 0. The
10 % pixels labeled 0 are the background. The pixels labeled 1 make up one
11 % object, the pixels labeled 2 make up a second object, and so on.
12 %
13 % [L,NUM] = BWLABEL(BW,N) returns in NUM the number of connected objects
14 % found in BW.
15 %
16 % Note: On the use of BWLABEL, BWLABELN, BWCONNCOMP, and REGIONPROPS
17 % ------------------------------------------------------------------
18 % The functions BWLABEL, BWLABELN, and BWCONNCOMP all compute connected
19 % components for binary images. BWCONNCOMP is the most recent addition
20 % to the Image Processing Toolbox and is intended to replace the use
21 % of BWLABEL and BWLABELN. It uses significantly less memory and is
22 % sometimes faster than the older functions.
23 %
24 % Input Output Memory Connectivity
25 % Dim Form Use
26 % ----------------------------------------------
27 % BWLABEL 2-D Double-precision High 4 or 8
28 % label matrix
29 %
30 % BWLABELN N-D Double-precision High Any
31 % label matrix
32 %
33 % BWCONNCOMP N-D CC struct Low Any
34 %
35 % To extract features from a binary image using REGIONPROPS using the
36 % default connectivity, just pass BW directly into REGIONPROPS, i.e.,
37 % REGIONPROPS(BW).
38 %
39 % To compute a label matrix having a more memory-efficient data type
40 % (e.g., uint8 versus double), use the LABELMATRIX function on the output
41 % of BWCONNCOMP. See the documentation for each function for more information.
42 %
43 % Class Support
44 % -------------
45 % BW can be logical or numeric, and it must be real, 2-D, and nonsparse.
46 % L is of class double.
47 %
48 % Example
49 % -------
50 % BW = logical([1 1 1 0 0 0 0 0
51 % 1 1 1 0 1 1 0 0
52 % 1 1 1 0 1 1 0 0
53 % 1 1 1 0 0 0 1 0
54 % 1 1 1 0 0 0 1 0
55 % 1 1 1 0 0 0 1 0
56 % 1 1 1 0 0 1 1 0
57 % 1 1 1 0 0 0 0 0]);
58 % L = bwlabel(BW,4)
59 % [r,c] = find(L == 2)
60 %
61 % See also BWCONNCOMP,BWLABELN,BWSELECT,LABELMATRIX,LABEL2RGB,REGIONPROPS.
62
63 % Copyright 1993-2008 The MathWorks, Inc.
64 % $Revision: 1.29.4.7 $ $Date: 2008/09/13 06:55:40 $
65
0.55 18589 66 iptchecknargin(1,2,nargin,mfilename);
0.39 18589 67 iptcheckinput(BW, {'logical' 'numeric'}, {'real', '2d', 'nonsparse'}, ...
68 mfilename, 'BW', 1);
69
0.06 18589 70 if (nargin < 2)
71 mode = 8;
0.11 18589 72 else
0.34 18589 73 iptcheckinput(mode, {'double'}, {'scalar'}, mfilename, 'N', 2);
0.08 18589 74 end
75
0.15 18589 76 if ~islogical(BW)
0.98 12118 77 BW = BW ~= 0;
0.06 12118 78 end
79
4.85 18589 80 [startRow,endRow,startCol,labelForEachRun,numComponents] = ...
81 labelBinaryRuns(BW,mode);
82
83 % Given label information, create output matrix.
1.04 18589 84 L = bwlabel2(startRow,endRow,startCol,labelForEachRun,size(BW,1), ...
0.13 18589 85 size(BW,2));