I'm trying to detect the darkness using picamera.
I guess I have to capture an image and elaborate it pixel by pixel getting the brightness or color value and if it is beyond a threshold that I consider "darkness" increase a counter, and finally see if at least e.g. 90% of pixels are "dark".
I found this https://picamera.readthedocs.io/en/release-1.13/api_array.html#piyuvarray but I don't understand how to read the array.
how can I do that?