0

Having played around with controlling the raspberry pi camera in python, I discovered that there is an aperture module and that this code takes a picture without throwing up an error which I thought was strange.

import picamera, time
with picamera.PiCamera() as camera:
    camera.apeture = 8
    camera.start_preview()
    time.sleep(2)
    camera.capture("test a.jpg")
    print("Done")

My question is, is changing the value for camera.apeture actually changing the aperture of the camera? And what are the possible maximum and minimum values for the aperture?

1

Is the aperture really changing?

The aperture is a physical property of the lens of the camera and thus cannot be changed via code (You can go through this for more details). The RPi camera module has a fixed aperture of f/2.8 (at least according to this, though I have seen people reporting different values elsewhere).

Limits that you can set aperture to

I'm not exactly sure of the limits you can set in your code. But, the aperture basically controls the amount of light the sensor is exposed to and is thus responsible for exposure. The effect which can be achieved via this are also achievable by changing the shutter speed and ISO settings among others. The camera module docs give you numerous examples on how to tinker with the exposure settings.

Hope this was some help!

  • If the software is not physically adjusting the aperture, how is it adjusting the aperture through the software? – Darth Vader Apr 11 '15 at 9:47
  • @DarthVader I've trying to figure out the same after seeing your question! Haven't found any answers yet, will post if I find anything of value. Are you able to effectively change the exposure with the command? For example, are you able to click low light images with it? – Vishaal Devanaboyina Apr 11 '15 at 10:02
  • the other python commands like camera.iso and camera.shutter_speed seem to work quite well, the camera.aperture command does not seem to do much. It suggests that maybe it adjusts the aperture through changing other parameters like shutter speed, or maybe it uses more or less of the pixels in the sensor to give the effect of different apertures – Darth Vader Apr 11 '15 at 10:13
3

The reason your code isn't throwing an error is that it's not an error to set a new attribute on an object instance in Python (there are a few exceptions to this noted in that post, but it's generally true). Hence, apeture isn't an attribute of the PiCamera class (I'm not sure where you discovered it, but it's not in the API docs), so when you set apeture on a PiCamera instance you're just creating a new attribute.

  • Nicely spotted. First clue should have been the misspelled attribute itself ;) – Ghanima Apr 13 '15 at 21:46
  • 1
    I should add that the accepted answer is absolutely correct in pointing out that the aperture is indeed a physical property and there's certainly no way of changing it in the code (moreover the Pi's camera module lens is fixed, although it can be replaced with a bit of careful effort). – Dave Jones Apr 13 '15 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.