This is a static copy of a profile reportHome
imcomplement (38075 calls, 3.555 sec)
Generated 05-Nov-2014 07:53:17 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/images/images/imcomplement.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
35 | im2 = imcomplementmex(im); | 38075 | 2.343 s | 65.9% |  |
36 | end | 38075 | 0.270 s | 7.6% |  |
29 | if isa(im, 'double') &&... | 38075 | 0.220 s | 6.2% |  |
34 | else | 38075 | 0.100 s | 2.8% |  |
All other lines | | | 0.621 s | 17.5% |  |
Totals | | | 3.555 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
images/private/imcomplementmex | MEX-file | 38075 | 1.913 s | 53.8% |  |
Self time (built-ins, overhead, etc.) | | | 1.642 s | 46.2% |  |
Totals | | | 3.555 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 36 |
Non-code lines (comments, blank lines) | 31 |
Code lines (lines that can run) | 5 |
Code lines that did run | 4 |
Code lines that did not run | 1 |
Coverage (did run/can run) | 80.00 % |
Function listing
time calls line
1 function im2 = imcomplement(im)
2 %IMCOMPLEMENT Complement image.
3 % IM2 = IMCOMPLEMENT(IM) computes the complement of the image IM. IM
4 % can be a binary, intensity, or truecolor image. IM2 has the same class and
5 % size as IM.
6 %
7 % In the complement of a binary image, black becomes white and white becomes
8 % black. For example, the complement of this binary image, true(3), is
9 % false(3). In the case of a grayscale or truecolor image, dark areas
10 % become lighter and light areas become darker.
11 %
12 % Note
13 % ----
14 % If IM is double or single, you can use the expression 1-IM instead of this
15 % function. If IM is logical, you can use the expression ~IM instead of
16 % this function.
17 %
18 % Example
19 % -------
20 % I = imread('glass.png');
21 % J = imcomplement(I);
22 % figure, imshow(I), figure, imshow(J)
23 %
24 % See also IMABSDIFF, IMADD, IMDIVIDE, IMLINCOMB, IMMULTIPLY, IMSUBTRACT.
25
26 % Copyright 1993-2004 The MathWorks, Inc.
27 % $Revision: 1.12.4.6 $ $Date: 2009/01/16 11:02:44 $
28
0.22 38075 29 if isa(im, 'double') && ~isreal(im)
30 % Handle double complex case for backward compatibility only.
31 % Previous code version errored on complex input for all types
32 % except double.
33 im2 = 1 - im;
0.10 38075 34 else
2.34 38075 35 im2 = imcomplementmex(im);
0.27 38075 36 end
Other subfunctions in this file are not included in this listing.