What is your definition of brightness? Do you want to convert to grayscale, CIELAB color space and take the L channel, or HSV color space and take the V channel?
brightness = rgb2gray(rgbImage);
hsvImage = rgb2hsv(rgbImage);
brightness = hsvImage(:, 3);
labImage = rgb2lab(rgbImage);
brightness = labImage(:, 1);
Best Answer