Code covered by the BSD License  

Highlights from
Consistent imaging with consumer cameras

image thumbnail

Consistent imaging with consumer cameras

by

 

08 Jul 2013 (Updated )

Accurate color capture using consumer cameras.

visualizeXYZ(xyz,numRow,numCol)
function visualizeXYZ(xyz,numRow,numCol)
%
% VISUALIZEXYZ(XYZ,NUMROW,NUMCOL)
%
% XYZ: matrix of Nx3 tristimulus values
% NUMROW: optional, # of rows to visualize the xyz values in, default 4
% NUMCOL: optional, # of cols to visualize the xyz values in, default 6
%
% ************************************************************************
% If you use this code, please cite the following paper:
%
%
% <paper>
%
% ************************************************************************
% For questions, comments and bug reports, please use the interface at
% Matlab Central/ File Exchange. See paper above for details.
% ************************************************************************


if nargin == 1
    numRow = 4;
    numCol = 6;
end
% size of patch, change as needed
N = 100;
outImg = (zeros(N*numRow,N*numCol,3));

num = size(xyz,1);

n = 1;

for row = 1:numRow
    for col = 1:numCol
        curXYZ = xyz(n,:);
        rgb = XYZ2ProPhoto(reshape(curXYZ,[1 1 3]));
        outImg(N*(row-1)+1:N*row,N*(col-1)+1:N*col,1) = rgb(1);
        outImg(N*(row-1)+1:N*row,N*(col-1)+1:N*col,2) = rgb(2);
        outImg(N*(row-1)+1:N*row,N*(col-1)+1:N*col,3) = rgb(3);
        n = n+1;
    end
end


imshow(uint8(255*outImg))

Contact us