I have an Android app where user takes a photo of himself with the front camera and then the photo is being uploaded to my server. I notice that many photos comes to my server too dark (sometimes almost impossible to cleary see the user face).
I would like to filter out such photos and show notification (eg. "Photo is too dark. Take one more picture") to the user in the app side. How I could accomplish such task in Android?
EDIT:
I have found out how to calculate brightness for one single pixel (thank's to this answer: https://stackoverflow.com/a/16313099/2999943):
private boolean isPixelColorBright(int color) {
if (android.R.color.transparent == color)
return true;
boolean rtnValue = false;
int[] rgb = {Color.red(color), Color.green(color), Color.blue(color)};
int brightness = (int) Math.sqrt(rgb[0] * rgb[0] * .299 + rgb[1]
* rgb[1] * .587 + rgb[2] * rgb[2] * .114);
if (brightness >= 200) { // light color
rtnValue = true;
}
return rtnValue;
}
But still I don't have clear idea how to determine whole image brightness "status". Any suggestions?