Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Mean luminance Values of an Image

Asked by M@lik Ali on 1 Feb 2013

Hi ALL,

I want to calculate the means luminance value of an image block

i found the formula is..

 luminance= 0.3 R + 0.59 G + 0.11 B

but how i can calculate the R, G and B values.

i know that

R=rgb_img(:,:,1) 
G=rgb_img(:,:,2) 
B=rgb_img(:,:,3) 

but it give in the shape of matrix, i think i need only a single value of R,G and B, to use above luminance formula.

please help me out.

Thanks in Advance

0 Comments

M@lik Ali

Tags

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 1 Feb 2013
Accepted answer
mean2(rgb2gray(rgb_img))

provided you have the toolbox installed.

Otherwise, calculate a luminance array using the R, G, B arrays, and then mean2() the luminance array.

1 Comment

M@lik Ali on 1 Feb 2013

nice it working, will it give me the mean luminance value of an iamge

Walter Roberson

Contact us