Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

Alternatively, just cv2.cvtColor from RGB to HSL and use the average L value.

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

Alternatively, just cv2.cvtColor from RGB to HSL and use the average L value.

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