This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
images/private/morphopfunction202
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
45
iptcheckinput(varargin{1}, {'l...
2020.030 s50.0%
54
BWP = bwpackc(BW);
2020.020 s33.3%
50
if ~islogical(BW)
2020 s0%
48
BW = varargin{1};
2020 s0%
44
iptchecknargin(1,1,nargin,mfil...
2020 s0%
All other lines  0.010 s16.7%
Totals  0.060 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
iptcheckinputMEX-file2020.010 s16.7%
images/private/bwpackcMEX-file2020 s0%
iptchecknarginfunction2020 s0%
Self time (built-ins, overhead, etc.)  0.050 s83.3%
Totals  0.060 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function54
Non-code lines (comments, blank lines)47
Code lines (lines that can run)7
Code lines that did run5
Code lines that did not run2
Coverage (did run/can run)71.43 %
Function listing
   time   calls  line
1 function BWP = bwpack(varargin)
2 %BWPACK Pack binary image.
3 % BWP = BWPACK(BW) packs the uint8 binary image BW into the uint32 array
4 % BWP, which is known as a packed binary image. Because each 8-bit
5 % pixel value in the binary image has only two possible values, 1 and
6 % 0, BWPACK can map each pixel to a single bit in the packed output
7 % image.
8 %
9 % BWPACK processes the image pixels by column, mapping groups of 32
10 % pixels into the bits of a uint32 value. The first pixel in the first
11 % row corresponds to the least significant bit of the first uint32
12 % element of the output array. The first pixel in the 32nd row
13 % corresponds to the most significant bit of this same element. The
14 % first pixel of the 33rd row corresponds to the least significant bit
15 % of the second output element, and so on. If BW is M-by-N, then BWP
16 % is CEIL(M/32)-by-N.
17 %
18 % Binary image packing is used to accelerate some binary morphological
19 % operations, such as dilation and erosion. If the input to IMDILATE or
20 % IMERODE is a packed binary image, the functions use a specialized
21 % routine to perform the operation faster.
22 %
23 % BWUNPACK is used to unpack packed binary images.
24 %
25 % Class Support
26 % -------------
27 % BW can be logical or numeric, and it must be 2-D, real, and
28 % nonsparse. BWP is uint32.
29 %
30 % Example
31 % -------
32 % Pack, dilate, and unpack a binary image:
33 %
34 % bw = imread('text.png');
35 % bwp = bwpack(bw);
36 % bwp_dilated = imdilate(bwp,ones(3,3),'ispacked');
37 % bw_dilated = bwunpack(bwp_dilated, size(bw,1));
38 %
39 % See also BWUNPACK, IMDILATE, IMERODE.
40
41 % Copyright 1993-2003 The MathWorks, Inc.
42 % $Revision: 1.10.4.4 $ $Date: 2004/08/10 01:38:45 $
43
202 44 iptchecknargin(1,1,nargin,mfilename);
0.03 202 45 iptcheckinput(varargin{1}, {'logical','numeric'}, {'real','2d','nonsparse'}, ...
46 mfilename, 'BW', 1);
47
202 48 BW = varargin{1};
49
202 50 if ~islogical(BW)
51 BW = BW ~= 0;
52 end
53
0.02 202 54 BWP = bwpackc(BW);

Other subfunctions in this file are not included in this listing.