How to Use image effects on Raspberry Pi

Source: Internet
Author: User

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.

  1. #!/usb/bin/python
  2. import os
  3. import time
  4. import subprocess
  5. list_ex=['auto','night']
  6. list_awb=['auto','cloud',flash']
  7. list_ifx=['blur','cartoon','colourswap','emboss','film','gpen','hatch','negative','oilpaint','posterise','sketch','solarise','watercolour']
  8. x=0
  9. for ex in list_ex:
  10. for awb in list_awb:
  11. for ifx in list_ifx:
  12. x=x+1
  13. filename='img_'+ex+'_'+awb+'_'+ifx+'.jpg'
  14. cmd='raspistill -o '+filename+'-n -t 1000-ex '+ex+'-awb '+awb+'-ifx '+ifx+'-w 640-h 480'
  15. pid=subprocess.call(cmd,shell=True)
  16. print "["+str(x)+"]-"+ex+"_"+awb+"_"+ifx+".jpg"
  17. time.sleep(0.25)
  18. 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:

  1. $ 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.

  1. $ 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:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.