Page 1 of 1

PILlow, PiCamera and rogue readings

Posted: Sun Jan 28, 2018 5:35 pm
by kramkroc
Hi folks,

getting close to finishing our project for the Space Lab. We're using PIL to calculate the mean brightness of our photos but find that the levels returned tend to be very high for the first picture and do tend to vary under on a theoretically steady light source. We can obviously discard the first image but wanted to know what is happening:

Code: Select all

	cam.capture(photoName) # Take photo of Earth
	image = Image.open(photoName).convert('L') # convert image to monochrome
	lux = ImageStat.Stat(image).mean[0] # calculate mean brightness/lux of image
Is the PiCamera (PiNoIR) doing some image adjustment? If so, can we turned it off?

/Mark

Re: PILlow, PiCamera and rogue readings

Posted: Mon Jan 29, 2018 9:28 am
by Davespice
Ah yes, you probably want to start the camera preview some seconds before you capture a photo to allow it to adjust to the light level.
So for example:

Code: Select all

cam.start_preview()
time.sleep(5)
cam.capture(photoName) # Take photo of Earth
cam.stop_preview()
image = Image.open(photoName).convert('L') # convert image to monochrome
lux = ImageStat.Stat(image).mean[0] # calculate mean brightness/lux of image

Re: PILlow, PiCamera and rogue readings

Posted: Mon Jan 29, 2018 10:35 am
by kramkroc
Cheers Dave! I'll try it later on, but in the meantime, if capturing pictures in a loop, do you think you should do the preview each time, or is it only for that very first capture? Just wondering how consistent a meter it is if the camera is adjusting to the light each time.

Re: PILlow, PiCamera and rogue readings

Posted: Mon Jan 29, 2018 11:32 am
by Davespice
You could keep the preview going continuously if you wanted, so start the preview, your main loop, stop the preview.