% Function to multiply a three-component color image by a 3x3 matrix for
% basis conversion
function col_IMG_out_basis = convert_color_basis(col_IMG_in_basis,A_in2out)
%reshape image to N by three and multiply by A_in2out transposed.
IMG = reshape(col_IMG_in_basis,[],3) * A_in2out';
col_IMG_out_basis = reshape(IMG,size(col_IMG_in_basis));