Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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)

Risposta accettata

Setsuna Yuuki.
Setsuna Yuuki. il 10 Nov 2020
Modificato: Setsuna Yuuki. il 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();

Più risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by