In this post, i will show you in a simple and easy way how to find average of R from RGB image.



clear;
 close all;
 clc;

 img = imread('C:\Users\US\Desktop\CompVision\images\lenna.jpg');
 %imresize(img,[200 200]);
 figure('units','normalized','outerposition',[0 0 1 1]),
 subplot(221), imshow(img), title('Lenna Image');
 [r, c, ch] = size(img);
 img_R =img(:,:,1);
 subplot(222), imshow(img_R), title('Channel Red');
 img_G =img(:,:,2);
 subplot(223), imshow(img_G), title('Channel Green');

 img_B =img(:,:,3);
 subplot(224), imshow(img_B), title('Channel Blue');