Saturday, June 21, 2008
Assign 4 Q 18
Q 18 Code for Rainbow is as follows:
Considering 6 colors, starting from Red and go up to magenta.
Red, Yellow, Green, Cyan, Blue,magenta:
Red+Green=Yellow
Red+Blue=Magenta
Blue+Green=cyan
R(:,:,1)=ones(256);
R(:,:,2)=ones(256,1)*[0:1:255]/255;
R(:,:,3)=zeros(256);
imshow(R)
Y(:,:,1)=ones(256,1)*[255:-1:0]/255;
Y(:,:,2)=ones(256);
Y(:,:,3)=zeros(256);
imshow(Y)
G(:,:,1)=zeros(256);
G(:,:,2)=ones(256);
G(:,:,3)=ones(256,1)*[0:1:255]/255;
imshow(G)
C(:,:,1)=zeros(256);
C(:,:,2)=ones(256,1)*[255:-1:0]/255;
C(:,:,3)=ones(256);
imshow(C)
B(:,:,1)=ones(256,1)*[0:1:255]/255;
B(:,:,2)=zeros(256);
B(:,:,3)=ones(256);
imshow(B)
M(:,:,1)=ones(256);
M(:,:,2)=zeros(256);
M(:,:,3)=ones(256,1)*[255:-1:0]/255;
imshow(M)
A=[R,Y,G,C,B,M];
imshow(A)
Note: Any other combination and order of colors can be considered and change the outlook of rainbow.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment