How to create rgb image uint8

6 vues (au cours des 30 derniers jours)
Angelos Naoum
Angelos Naoum le 30 Déc 2017
Réponse apportée : Jan le 30 Déc 2017
I want to create RGB image 100x8 for every color as uint8. I have done what I want but for double format.
image=zeros(100,8,3); %initialize
image(:,1,1)=1; %R
image(:,2,2)=1; %G
image(:,3,3)=1; %B
image(:,4,[2 3])=1; %C
image(:,5,[1 3])=1; %M
image(:,6,[1 2])=1; %Y
image(:,7,:)=0; %K
image(:,8,:)=1; %W
subimage(image);

Réponse acceptée

Jan
Jan le 30 Déc 2017
Using your image array:
imageUINT8 = uint8(image * 255);
Or directly:
imageUINT8 = zeros(100,8,3, 'uint8');
image(:,1,1) = 255; % Implicit cast to UINT8
...

Plus de réponses (0)

Catégories

En savoir plus sur Convert Image Type 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