Filter löschen
Filter löschen

How to convert uint8 to rgb image in MATLAB r2018b?

21 Ansichten (letzte 30 Tage)
Kaniska Samanta
Kaniska Samanta am 24 Apr. 2019
Kommentiert: Kaniska Samanta am 29 Apr. 2019
I have a 365x466x3 uint8 matrix and I need to convert it into RGB model. when I used the command "ind2rgb" i am getting the following problem, "Unable to perform assignment because the size of the left side is 365-by-466 and the size of the right side is 365-by-466-by-3." Any solution?? Thanks in advance.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 24 Apr. 2019
365 x 466 x 3 is already RGB, unless it is HSV or L*a*b* or similar.
If you had a 365 x 466 indexed image and a colormap then you could use ind2rgb() to convert it to RGB, but you would typically assign the result to an entire variable rather than to a portion of a variable. But it could be done, such as
for K = 1 : length(filenames)
[ind, cmap] = imread( filenames{K} );
all_images(:,:,:,K) = ind2rgb(ind, cmap);
end

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by