MATLAB: How to normalize a XYZ matrix to convert them into rgb values

color spacexyz to rgb

I have a XYZ n-by-3 matrix and I want to normalized it in order to convert these values into rgb values with the xyz2rgb function. How can I do it? I am not that good at mathematics, and I am stuck on this step.

Best Answer

Specify 'OutputType' as 'uint8', like this:
xyz = rand(100, 3); % Whatever....
rgb = xyz2rgb(xyz, 'OutputType','uint8'); % Convert xyz into rgb
Related Question