How to convert uint8 to rgb image in MATLAB r2018b?
23 views (last 30 days)
Show older comments
Kaniska Samanta
on 24 Apr 2019
Commented: Kaniska Samanta
on 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.
0 Comments
Accepted Answer
Walter Roberson
on 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
More Answers (0)
See Also
Categories
Find more on Modify Image Colors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!