How to Use image effects on Raspberry Pi
Now you can use the Raspberry Pi camera module ("raspi cam") to add a variety of image effects to your photos, just like using a card camera. The raspistill command line tool provides a wide range of image effects options for Raspberry Pi to beautify your images.
There are three command line tools that can be used to capture photos or videos taken by raspicam. In this article, we will focus on the raspstill tool. The raspstill tool provides a variety of control options to process images, such as sharpness, contrast, brightness, and saturation), ISO, AWB, and image effects.
This article describes how to use the raspstill tool and the raspicam camera module to control photo exposure, AWB, and other image effects. I wrote a simple python script to automatically take photos and apply various image effects to those photos. Raspicam's help document describes the exposure modes, AWB, and image effects supported by the camera module. In general, raspicam supports 16 image effects, 12 exposure modes, and 10 AWB options.
The Python script is simple, as shown below.
#!/usb/bin/python
import os
import time
import subprocess
list_ex=['auto','night']
list_awb=['auto','cloud',flash']
list_ifx=['blur','cartoon','colourswap','emboss','film','gpen','hatch','negative','oilpaint','posterise','sketch','solarise','watercolour']
x=0
for ex in list_ex:
for awb in list_awb:
for ifx in list_ifx:
x=x+1
filename='img_'+ex+'_'+awb+'_'+ifx+'.jpg'
cmd='raspistill -o '+filename+'-n -t 1000-ex '+ex+'-awb '+awb+'-ifx '+ifx+'-w 640-h 480'
pid=subprocess.call(cmd,shell=True)
print "["+str(x)+"]-"+ex+"_"+awb+"_"+ifx+".jpg"
time.sleep(0.25)
print "End of image capture"
This script has completed the following work. First, the script defines three lists for enumeration of the exposure mode, AWB mode, and image effects. In this example, we will use two exposure modes, three AWB modes, and 13 image effects. The script traverses the combinations of the preceding three options and uses these parameter combinations to run the raspistill tool. There are 6 input parameters: (1) output file name; (2) exposure mode; (3) AWB mode; (4) image effect mode; (5) Photo time, set to 1 second; (6) image size, set to 640x480. The script will automatically take 78 photos, each of which will apply different special effect parameters.
To execute this script, you only need to enter the following command line:
$ python name_of_this_script.py
Below are some samples captured.
Small benefits
In addition to using the raspistill command line tool to manipulate the raspicam camera module, there are other methods to use. Picamera is a python library that provides APIs for manipulating the raspicam camera module, so that you can easily build more complex applications. If you are proficient in python, picamera must be a good partner of your hack project. Picamera has been integrated into the image of the latest version of Raspbian by default. Of course, if you are not using the latest Raspbian or other operating system versions, you can install it manually using the following method.
First, install pip on your system. For more information, see the instructions.
Then, you can install picamera as follows.
$ sudo pip install picamera
For instructions on how to use picamera, see the official documentation.
Install NodeJS on the (Raspberry Pi) Raspberry Pi
Install Weston on Raspberry Pi
Linux OS for Raspberry Pi is available
Raspberry Pi (Raspberry Pi) trial note
Introduction to Raspberry Pi (Raspberry Pi) installation, IP configuration, and software source
This article permanently updates the link address: