Effacer les filtres
Effacer les filtres

Convert it into index type

2 vues (au cours des 30 derniers jours)
Nour George
Nour George le 12 Juil 2020
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 ?
  1 commentaire
madhan ravi
madhan ravi le 12 Juil 2020
What do you mean by index type?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 12 Juil 2020
[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)

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by