Ask Your Question

How to get luminosity from the camera Android ?

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

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-23 09:53:38 -0500

l3an gravatar image

updated 2015-07-23 12:53:38 -0500

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."

edit flag offensive delete link more


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

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

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

l3an gravatar imagel3an ( 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

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

that was a typo; fixed

l3an gravatar imagel3an ( 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

LorenaGdL gravatar imageLorenaGdL ( 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

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

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

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-24 03:46:14 -0500 )edit

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

LorenaGdL gravatar imageLorenaGdL ( 2015-07-24 05:38:17 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


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

Seen: 491 times

Last updated: Jul 23 '15