2013-05-05 110 views

回答

0
%matmap2rgb 
%converts a MxN matrix, and a Lx3 matrix to MxNx3 matrix 
%syntax: matmap2rgb(mat, map); 
function outrgbmat=matmap2rgb(mat, map) 
rowVect=map(mat+1,:); 
outrgbmat(:,:,1)=reshape(rowVect(:,1),size(mat,1),size(mat,2)); 
outrgbmat(:,:,2)=reshape(rowVect(:,2),size(mat,1),size(mat,2)); 
outrgbmat(:,:,3)=reshape(rowVect(:,3),size(mat,1),size(mat,2)); 
end