Apply image effect to Raspberry Pi camera module

0
926
Raspberry Pi & Camera
Raspberry Pi & Camera

To apply image effects to the camera, we will use the image_effect property to set the appropriate effect to the camera while working.

The list of supported image effects is listed on this page, make sure to check it out. The following simple script I wrote to demonstrate all effects that currently work on my camera module (rev 1.3)


 # app.py
import picamera
from time import sleep
effects = ['none', 'negative', 'sketch', 'denoise', 'emboss', 'oilpaint', 'hatch', 'gpen', 'pastel', 'watercolor', 'film', 'blur', 'saturation']
camera = picamera.PiCamera()
camera.resolution = (1280, 720)
camera.start_preview()
sleep(2)
for s in effects:
    print("Effect: " + s)
    camera.image_effect = s
    camera.capture('snapshot_' + s + '.jpg')
camera.stop_preview()

The script will generated captured images in correspondent effects in current directory with effect name as suffix.