
function [leafColor]= mean_leaf(I)
   
    % Separate to RGB channel
    Ir = I(:,:,1);
    Ig = I(:,:,2);
    Ib = I(:,:,3);

    % Extract the background (black) region
    Igray = rgb2gray(I);
    idx = Igray ~= 0;

    % Calculate average RGB of the region
    Rave = mean(Ir(idx));
    Gave = mean(Ig(idx));
    Bave = mean(Ib(idx));
   
    leafColor= [Rave, Gave, Bave];

end