Effacer les filtres
Effacer les filtres

How can I make image with specific color in each column???

3 vues (au cours des 30 derniers jours)
Beso_h
Beso_h le 10 Nov 2020
a) 256 × 256 image that have 256 colors on it starting 0 till 255 (the first column is black, the last column is white, and in between all the gray shades)
b) 256 × 256 image that have just 8 colors on it starting 0 till 7 (the first column is black, the last column is white, and in between all the gray shades)

Réponse acceptée

Setsuna Yuuki.
Setsuna Yuuki. le 10 Nov 2020
Modifié(e) : Setsuna Yuuki. le 10 Nov 2020
You can use this code to generate the color rows:
clear all;
figure
for bits = 1:1:8
Color=2^bits; %Number of colors level
intervalo = 1/(Color-1); %intervales to each color
C = zeros(Color,1,3); %To change rows by columns change this line zeros(1,Color,3)
s = 1:-intervalo:0;
C(:,:,1) = s'; % Red
C(:,:,2) = s'; % Green
C(:,:,3) = s'; % Blue
subplot(3,3,bits);
image(C); % C is mean of three channel (RGB)
numeroBits = num2str(bits);
title({'\fontsize{12} Número de bits:' numeroBits});
axis off;
end
To resize you can use imresize();

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing 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