This is a static copy of a profile report

Home

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

Parents (calling functions)

Function NameFunction TypeCalls
ml_rcthresholdfunction404
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
75
y = imhistc(a, n, isScaled, to...
4040.921 s54.1%
90
x = linspace(range(1), range(2...
4040.411 s24.1%
78
range = getrangefromclass(a);
4040.190 s11.2%
59
[a, n, isScaled, top, map] = p...
4040.160 s9.4%
96
yout = y;
4040.010 s0.6%
All other lines  0.010 s0.6%
Totals  1.702 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
images/private/imhistcMEX-file4040.921 s54.1%
linspacefunction4040.391 s22.9%
getrangefromclassfunction4040.160 s9.4%
imhist>parse_inputssubfunction4040.160 s9.4%
Self time (built-ins, overhead, etc.)  0.070 s4.1%
Totals  1.702 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function97
Non-code lines (comments, blank lines)63
Code lines (lines that can run)34
Code lines that did run18
Code lines that did not run16
Coverage (did run/can run)52.94 %
Function listing
   time   calls  line
1 function [yout,x] = imhist(varargin)
2 %IMHIST Display histogram of image data.
3 % IMHIST(I) displays a histogram for the intensity image I whose number of
4 % bins are specified by the image type. If I is a grayscale image, IMHIST
5 % uses 256 bins as a default value. If I is a binary image, IMHIST uses
6 % only 2 bins.
7 %
8 % IMHIST(I,N) displays a histogram with N bins for the intensity image I
9 % above a grayscale colorbar of length N. If I is a binary image then N
10 % can only be 2.
11 %
12 % IMHIST(X,MAP) displays a histogram for the indexed image X. This
13 % histogram shows the distribution of pixel values above a colorbar of the
14 % colormap MAP. The colormap must be at least as long as the largest index
15 % in X. The histogram has one bin for each entry in the colormap.
16 %
17 % [COUNTS,X] = imhist(...) returns the histogram counts in COUNTS and the
18 % bin locations in X so that stem(X,COUNTS) shows the histogram. For
19 % indexed images, it returns the histogram counts for each colormap entry;
20 % the length of COUNTS is the same as the length of the colormap.
21 %
22 % Class Support
23 % -------------
24 % An input intensity image can be uint8, int8, uint16, int16, uint32,
25 % int32, single, double, or logical. An input indexed image can be uint8,
26 % uint16, single, double, or logical.
27 %
28 % Note
29 % ----
30 % For intensity images, the N bins of the histogram are each half-open
31 % intervals of width A/(N-1).
32 %
33 % For uint8, uint16, and uint32 intensity images, the p-th bin is the
34 % half-open interval:
35 %
36 % A*(p-1.5)/(N-1) <= x < A*(p-0.5)/(N-1)
37 %
38 % For int8, int16, and int32 intensity images, the p-th bin is the
39 % half-open interval:
40 %
41 % A*(p-1.5)/(N-1) - 32768 <= x < A*(p-0.5)/(N-1) - 32768
42 %
43 % The intensity value is represented by "x". The scale factor A depends
44 % on the image class. A is 1 if the intensity image is double or single;
45 % A is 255 if the intensity image is uint8 or int8; A is 65535 if the
46 % intensity image is uint16 or int16; A is 4294967295 if the intensity
47 % image is uint32 or int32.
48 %
49 % Example
50 % -------
51 % I = imread('pout.tif');
52 % imhist(I)
53 %
54 % See also HISTEQ, HIST.
55
56 % Copyright 1992-2010 The MathWorks, Inc.
57 % $Revision: 5.24.4.16.2.1 $ $Date: 2011/07/18 00:34:05 $
58
0.16 404 59 [a, n, isScaled, top, map] = parse_inputs(varargin{:});
60
404 61 if islogical(a)
62 if (n ~= 2)
63 error(message('images:imhist:invalidParameterForLogical'))
64 end
65 y(2) = sum(a(:));
66 y(1) = numel(a) - y(2);
67 y = y';
0.01 404 68 elseif isa(a,'int8')
69 y = imhistc(int8touint8(a), n, isScaled, top); % Call MEX file to do work.
404 70 elseif isa(a, 'int16')
71 y = imhistc(int16touint16(a), n, isScaled, top); % Call MEX file to do work.
404 72 elseif isa(a, 'int32')
73 y = imhistc(int32touint32(a), n, isScaled, top); % Call MEX file to do work.
404 74 else
0.92 404 75 y = imhistc(a, n, isScaled, top); % Call MEX file to do work.
404 76 end
77
0.19 404 78 range = getrangefromclass(a);
79
404 80 if ~isScaled
81 if isfloat(a)
82 x = 1:n;
83 else
84 x = 0:n-1;
85 end
404 86 elseif islogical(a)
87 x = range';
404 88 else
89 % integer or float
0.41 404 90 x = linspace(range(1), range(2), n)';
404 91 end
92
404 93 if (nargout == 0)
94 plot_result(x, y, map, isScaled, class(a), range);
404 95 else
0.01 404 96 yout = y;
404 97 end

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