Question

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..

Was it helpful?

Solution

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')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top