I don't understand the Icolored(:,:,1/2/3).

2 views (last 30 days)
Please help me to understand the 3 lines of this code:
function [F]=get_image_features(Icolored) %Icolored is the image coming from the line F=get_image_features(I); from create_learning_set.m file
%%get R G B components of the sub-image
R = Icolored(:,:,1);
G = Icolored(:,:,2);
B = Icolored(:,:,3);
%%Get random 128 x 128 sub-image
% R=rnad_subimage(R);
% G=rnad_subimage(G);
% B=rnad_subimage(B);
%%get the features of each channel
Rf=get_channel_features(R);
Gf=get_channel_features(G);
Bf=get_channel_features(B);
%the feature vector
F=[Rf Gf Bf];
end
These 3 line are:
R = Icolored(:,:,1);
G = Icolored(:,:,2);
B = Icolored(:,:,3);

Accepted Answer

Nitin
Nitin on 21 Jun 2013
Coloured images are basically made up of Red, Green and Blue channels. Each colour code is stored in a given dimension and what you see is the combination of the three. What these three lines are essentially doing is giving you the option to see them in their individual colour code, R,G & B.
This post should make things clearer, http://www.mathworks.com.au/matlabcentral/answers/19083

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!