Convert it into index type

1 次查看(过去 30 天)
I have this two Question :
1)Read the image (‘flage.png’)?
2)Convert it into index type and display it ?
I solved the first one :
image_mat = imread('flage.png');
But How can i solve the second one ?

采纳的回答

Walter Roberson
Walter Roberson 2020-7-12
[image_mat, cmap] = imread('flage.png');
if isempty(cmap)
if ndims(image_mat) > 2
image_rgb = image_mat;
else
image_rgb = repmat(image_mat, [1 1 3]);
end
else
image_rgb = ind2rgb(image_mat, cmap);
end
imshow(image_rgb)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by