필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Beso_h
Beso_h 2020년 11월 10일
편집: Setsuna Yuuki. 2020년 11월 10일
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)

채택된 답변

Setsuna Yuuki.
Setsuna Yuuki. 2020년 11월 10일
편집: Setsuna Yuuki. 2020년 11월 10일
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();

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by