简体   繁体   中英

3D double Array to RGB in MATLAB

I have 256 x 256 x 3 double Array. How to create (RGB) picture from it in Mat-lab. The values are like (3091, 986, 1003, 1699). Thanks in advance..

You can normalise the values in the matrix so that they lie between 0 and 1 and then use the command imshow :

// create a random example of a matrix
I = 4000*rand(256, 256, 3);

// normalise the values in I
for i = 1:3
    I(:, :, i) = I(:, :, i)/max(max(I(:, :, i)));
end

// display as image
imshow(I, 'InitialMagnification', 'fit')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM