Ask Your Question

# How to get luminosity from the camera Android ?

Is there a possibility to retrieve luminosity from camera at the current time?

edit retag close merge delete

## 1 answer

Sort by ยป oldest newest most voted

I don't have any android experience, but you can easily calculate luminosity like so...

1) Splitting image into R, G, B values, something like b, g, r = cv2.split(img)

2) Average the b, g, r values over the entire image --> b_avg = average(b)

3) compute luminosity w/ the following equation: double luminosity = r_avg*0.299 + g_avg*0.587 + b_avg*0.114

from this tutorial:

"The reason these values are weighted is because pure red, green and blue are actually darker/lighter than each other, with green being the darkest and blue being the lightest."

more

## Comments

I do not agree that the luminosity is the same as luminance; see this

( 2015-07-23 10:51:29 -0500 )edit

@thdrksdfthmn interesting. thanks...I've removed that portion of the answer

( 2015-07-23 11:16:41 -0500 )edit

@l3an your answer still show solution for finding luminance and not luminosity. Anyway I'm not sure what the OP wants regarding his own tags for the question

( 2015-07-23 11:38:37 -0500 )edit

that was a typo; fixed

( 2015-07-23 12:54:04 -0500 )edit

Still disagree, because you are actually computing luminance, as when converting from RGB to YUV color spaces

( 2015-07-23 13:03:50 -0500 )edit

luminance = luminosity / m.squared. So the asker just needs to multiply the luminance value by the area being photographed? or the area of the lens? please explain @Lorena GdL instead of just telling me that I'm wrong

( 2015-07-23 13:22:54 -0500 )edit

?? where is m.squared? what is it? was there a comment edited or deleted?

( 2015-07-24 03:46:14 -0500 )edit
2

@thdrksdfthmn there wasn't any deleted comment. I don't know what that came from either

( 2015-07-24 05:38:17 -0500 )edit

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2015-07-23 08:59:55 -0500

Seen: 591 times

Last updated: Jul 23 '15