A=imread('football.jpg'); %也可读入RGB图像peppers.png
R=A(:, :, 1);
G=A(:, :, 2);
B=A(:, :, 3);
subplot(2, 2, 1), imshow(A), title('原始图像');
subplot(2, 2, 2), imshow(R), title('R层图像');
subplot(2, 2, 3), imshow(G), title('G层图像');
subplot(2, 2, 4), imshow(B), title('B层图像');
0