Mean luminance Values of an Image

156 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 1 Feb 2013
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.
  4 Comments
Maria Hernandez
Maria Hernandez on 6 Jul 2017
Thanks for taking the time to answer, Walter =)

Sign in to comment.

More Answers (1)

Rodrigo Souza
Rodrigo Souza on 28 Jan 2019
Hi all,
I have put together three scripts for calculating (mean and SD), matching or normalizing luminance of colored images (using HSV and CIE Lab color spaces).
They may be specially useful for pupillometry measures of infant research.
The scripts and their descriptions are available at my OSF page: https://osf.io/auzjy/
Hope it helps.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by