1

请帮助我理解这段代码的 3 行:

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

这 3 行是:

R = Icolored(:,:,1);
G = Icolored(:,:,2);
B = Icolored(:,:,3);
4

1 回答 1

1

matlab将调用的图像Icolored读取为一个三维矩阵,每个颜色分量都有一层。

例如,给定一个 20 x 20 的图像:

%% Icolored is 20 x 20 x 3
R = Icolored(:,:,1);
G = Icolored(:,:,2);
B = Icolored(:,:,3);

R, G,B是各自的层,每个层都是一个 20 x 20 的颜色强度值矩阵。

于 2013-06-21T07:35:17.877 回答