Page 1 of 1

PiCamera as Luminosity Sensor?

Posted: Tue Dec 05, 2017 1:53 pm
by gschwiersch
Hi,

I have a team of students who would like to use the PiCamera as a luminosity sensor for Mission Space Lab. Does anyone have any resources on how to do this? (They're investigating light pollution.)

Thanks,
Gail

Re: PiCamera as Luminosity Sensor?

Posted: Tue Dec 05, 2017 3:54 pm
by bensimmo
I would be looking through here to get ideas
https://picamera.readthedocs.io/

Disable automatic adjusting parts (if possible)

Collect a reading, do some maths.
Collect another reading, do some maths.
Compare reading.

Deciding what to record is probably the hard part ?

IR only, Blue only etc ?

Re: PiCamera as Luminosity Sensor?

Posted: Tue Dec 05, 2017 4:31 pm
by gschwiersch
That's great, thanks!!!

Re: PiCamera as Luminosity Sensor?

Posted: Tue Dec 05, 2017 5:01 pm
by gordon77
Not sure exactly what you need but you get some ideas from my auto-guider python script. https://github.com/Gordon999/Pi-AutoGuider

Ignore the auto-guider parts, but is does allow you to set the pi camera and show a graph of luminance of a star, you can also filter as R, G, or B.

Maybe give you some ideas.

Re: PiCamera as Luminosity Sensor?

Posted: Wed Dec 06, 2017 8:43 am
by Davespice
If you're happy with decoding some binary you could take pictures in raw YUV format, where Y is luminance.
More info here (including how the binary data is represented): http://picamera.readthedocs.io/en/relea ... yuv-format

Re: PiCamera as Luminosity Sensor?

Posted: Wed Dec 06, 2017 9:04 am
by sparkie777
I'm running raspberries with the camera modules configured as network cameras suitable for motion detect (on remote machines) like this:

Code: Select all

/usr/bin/mjpg_streamer -o output_http.so -w ./www -i input_raspicam.so -x 1920 -y 1440 -fps 3
to evaluate the brightness remotely I simply issue:

Code: Select all

wget -q http://<ip-address>:8080/?action=snapshot -O - | convert - -colorspace Gray -format \"%[fx:quantumrange*image.mean]\" info:
this throws a single number dependent on the brightness detected. There are many more options supported by 'convert'.

<ip-address> is the ip address of the camera. You can do all locally on your raspberry as well of course.

Re: PiCamera as Luminosity Sensor?

Posted: Wed Dec 06, 2017 12:27 pm
by gschwiersch
Thanks Davespice :) !

Bensimmo kindly pointed me in this direction too. Funny thing is... when I went to tell the students about this, they had actually just found it, entirely on their own. (This kind of resourcefulness and independence makes teachers really, really happy :D )
Davespice wrote:
Wed Dec 06, 2017 8:43 am
If you're happy with decoding some binary you could take pictures in raw YUV format, where Y is luminance.
More info here (including how the binary data is represented): http://picamera.readthedocs.io/en/relea ... yuv-format

Re: PiCamera as Luminosity Sensor?

Posted: Wed Dec 06, 2017 12:29 pm
by gschwiersch
Thanks for all of your replies :)

PiCamera as Luminosity Sensor - Python Code Available?

Posted: Tue Aug 06, 2019 6:54 pm
by amcdonley
Would love a post project report and to see luminosity sensor code.

I want to use PiCamera (v1.3) to measure room light level over 24hr periods - don't need calibrated value, just continuous values from darkness to brightly lit.