What is RGB?
RGB color space or RGB color system, constructs all the colors from the combination of the Red,Green and Blue colors.
The red, green and blue use 8 bits each, which have integer values from 0 to 255. This makes 256*256*256=16777216 possible colors.
RGB ≡ Red, Green, Blue
Each pixel displays colors this way, by combination of red, green and blue Channels
Image Convert in RGB and Separate
%#
Initialization:
img =
imread('3.jpg'); %# img is variable and imread is function to
read image
size(img) %#
size is a function it is show the size of variable
ans 2448
3264 3
R=img;
B=img;
G=img;
G(:,:,1:2:3)=0; %#
In this function : mean all row column and color channel 1,2,3 is equal to 0 so then that will show just Green Channel of the image
R(:,:,2:3)=0; %# it is use for Red Channel of the image
B(:,:,1:2)=0; %# it is use for Blue Channel of the image
imshow(R)
imshow(B)
imshow(G)
crop =
R(1:1108,1:1629,:); %# in which we select some Red Channel area of the image
crop1 = B
(1:1108,1629:3264,:);
crop2 =
G(1108:2448,1:1629,:);
img(1:1108,1:1629,:)=crop
; %# here we replace our selected Red Channel area with our original image
img(1:1108,1629:3264,:)=crop1;
img(1108:2448,1:1629,:)=
crop2;
imshow(img)
No comments:
Post a Comment