Line | |
---|
1 | function I=rgb2double(I) |
---|
2 | % RGB2DOUBLE Convert RGB image to double format |
---|
3 | % I=RGB2DOUBLE(I) converts the RGB image J from class 'uint8', |
---|
4 | % 'uint16' or 'double' to class 'double. |
---|
5 | % |
---|
6 | % See RGB2XYZ(). |
---|
7 | |
---|
8 | % AUTORIGHTS |
---|
9 | % Copyright (C) 2006 Andrea Vedaldi |
---|
10 | % |
---|
11 | % This file is part of VLUtil. |
---|
12 | % |
---|
13 | % VLUtil is free software; you can redistribute it and/or modify |
---|
14 | % it under the terms of the GNU General Public License as published by |
---|
15 | % the Free Software Foundation; either version 2, or (at your option) |
---|
16 | % any later version. |
---|
17 | % |
---|
18 | % This program is distributed in the hope that it will be useful, |
---|
19 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | % GNU General Public License for more details. |
---|
22 | % |
---|
23 | % You should have received a copy of the GNU General Public License |
---|
24 | % along with this program; if not, write to the Free Software Foundation, |
---|
25 | % Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
26 | |
---|
27 | switch class(I) |
---|
28 | case 'uint8' |
---|
29 | I = double(I)/(2^8-1) ; |
---|
30 | |
---|
31 | case 'uint16' |
---|
32 | I = double(I)/(2^16-1) ; |
---|
33 | |
---|
34 | case 'double' |
---|
35 | otherwise |
---|
36 | error(['Data type ''', class(I), ''' not supported.']) ; |
---|
37 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.