/usr/share/octave/site/m/vlfeat/toolbox/imop/vl_rgb2xyz.m is in octave-vlfeat 0.9.17+dfsg0-6+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | function J=vl_rgb2xyz(I,ws)
% VL_RGB2XYZ Convert RGB color space to XYZ
% J=VL_RGB2XYZ(I) converts the CIE RGB image I to the image J in
% CIE XYZ format. CIE RGB has a white point of R=G=B=1.0
%
% VL_RGB2XYZ(I,WS) uses the specified RGB working space WS. The
% function supports the following RGB working spaces:
%
% * `CIE' E illuminant, gamma=2.2
% * `Adobe' D65 illuminant, gamma=2.2
%
% The default workspace is CIE.
%
% See also: VL_XYZ2RGB(), VL_HELP().
% Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
% All rights reserved.
%
% This file is part of the VLFeat library and is made available under
% the terms of the BSD license (see the COPYING file).
[M,N,K] = size(I) ;
if K~=3
error('I must be a MxNx3 array.') ;
end
I=im2double(I) ;
if(nargin < 2)
workspace = 'CIE' ;
else
workspace = ws ;
end
switch workspace
case 'CIE'
% CIE: E illuminant and 2.2 gamma
A = [
0.488718 0.176204 0.000000
0.310680 0.812985 0.0102048
0.200602 0.0108109 0.989795 ]' ;
gamma = 2.2 ;
case 'Adobe'
% Adobe 1998: D65 illuminant and 2.2 gamma
A = [
0.576700 0.297361 0.0270328
0.185556 0.627355 0.0706879
0.188212 0.0752847 0.99124 ]' ;
gamma = 2.2 ;
end
[M,N,K] = size(I) ;
I = reshape(I.^gamma, M*N, K) ;
J = A*I' ;
J = reshape(J', M, N, K) ;
|