Chapter 8 The Raspberry Pi Camera Module 209
THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE
camera.contrast = 0
This sets the contrast of the image. A higher number will make things look more dramatic
and stark; a lower number will make things look more washed out. You can use any number
between -100 for minimum contrast and 100 for maximum contrast.
camera.crop = (0.0, 0.0, 1.0, 1.0)
This allows you to crop the image, cutting parts off the sides and tops to capture only the part
of the image you need. The numbers represent X coordinate, Y coordinate, width, and height,
and by default captures the full image. Try reducing the last two numbers – 0.5 and 0.5 is a
good starting point – to see what effect this setting has.
camera.exposure_compensation = 0
This sets the exposure compensation of the camera, allowing you to manually control how much
light is captured for each image. Unlike changing the brightness setting, this actually controls the
camera itself. Valid values range from -25 for a very dark image to 25 for a very bright image.
camera.exposure_mode = 'auto'
This sets the exposure mode, or the logic the Camera Module uses to decide how an image
should be exposed. Possible modes are: off, auto, night, backlight, spotlight,
sports, snow, beach, verylong, fixedfps, antishake, and fireworks.
camera.framerate = 30
This sets the number of images captured to create a video per second, or the frame rate. A
higher frame rate creates a smoother video, but takes up more storage space. Higher frame
rates require a lower resolution to be used, which you can set via camera.resolution.
camera.hflip = False
This flips the camera image across the horizontal, or X, axis when set to True.
camera.image_effect = 'none'
This applies one of a range of image effects to the video stream, which will be visible in the preview
as well as the saved images and videos. Possible effects are: blur, cartoon, colorbalance,
colorpoint, colorswap, deinterlace 1 , deinterlace 2 , denoise, emboss, film,
gpen, hatch, negative, none, oilpaint, pastel, posterise, saturation, sketch,
solarize, washedout, and watercolor.
camera.ISO = 0
This changes the ISO setting of the camera, which affects how sensitive it is to light. By default, the
camera adjusts this automatically depending on the available light. You can set the ISO yourself
using one of the following values: 100, 200, 320, 400, 500, 640, 800. The higher the ISO, the better
the camera will perform in low-light environments but the grainier the image or video it captures.