Matlab - Image Formation - Matrix -
i doing interesting computer vision project talks how "create manually" images matlab.
the teacher gave me 3 matrices: illuminant matrix (called e), camera sensitivity matrix (called r) , finally, surface reflectance matrix (called s). matrix dimensions follows:
s: 31x512x512 (reflectance samples x x-dimension x y-dimension) r: 31x3 e: 31x1
the teacher gave me following relationship:
p=transpose(c)*r=transpose(s)*diagonal(e)*r
where c color matrix. p sensor response matrix.
the goal display image formed previous matrices. therefore, have compute p matrix.
the class of matrices double.
this have done:
diag_d=diag(d);% diagonal matrix of d s_reshaped= reshape(s,31,[512*512]);% reshape surface reflectance matrix s_permute=permute(s_reshaped,[2 1]);% output matrix 262144x31 matrix color_signal_d65_buffer=s_permute*diag_dd; color_signal_d65=reshape(color_signal_d65_buffer,[512 512 31]);% final color matrix image_d65_buffer= (reshape(color_signal_d65,[512*512],31))*r;% apply given formula image_d65= reshape(image_d65_buffer,[512 512 3]);% image formation image_d65_norm=sqrt(sum(image_d65.^2,3));% compute image_d65 norm image_d65_normalized=bsxfun(@rdivide, image_d65, image_d65_norm);% divide each element of matrix norm in order normalize matrix figure imshow(image_d65_normalized)% display image
however,it did not work @ all. output image colors wrong (there blue on image). think matrix reshaping problem have tried possible combinations nothing do.
thank help
Comments
Post a Comment