Monday, July 15, 2024

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages

Building Image Processing Embedded Systems Using Python

This project describes a technique to capture human faces using image processing and turn on an LED on the Arduino board. With some modification it can be used to detect intruders and set an alarm.

Embedded system components
Five basic components required to build an embedded system using Python are described below briefly.
Operating system (OS). The OS is the heart of an embedded vision system. Many dependencies that are required to run software are provided by the OS, which is the interface between the hardware and the application software. There are various Linux distributions, such as Ubuntu and Fedora, to choose from. I prefer Ubuntu as it is easy to learn.

Fig. 1: Block diagram of different modules in OpenCV

Image processing (IP) software. There are many software and libraries available for image processing, such as MATLAB and OpenCV. I prefer OpenCV as it is free, fast, has good documentation, tutorials, user groups, forums, etc. There are a lot of pre-built functions and algorithms to get a head start. There is active development on interfaces for other languages like Ruby, Python, MATLAB, etc. Fig. 1 is a block diagram showing the different modules in OpenCV.

Arduino. To control peripheral devices, we need a hardware circuit with a ‘brain.’ This role can be played by any microcontroller or microprocessor. A microcontroller cannot be directly used in a circuit as it is. A full development circuit board has to be made, providing access to different pins of the microcontroller. Here, Arduino development board is used due to the following reasons:

1. It is open source, so all schematics are available and you can design the same board on your own.
2. It is based on the concept of breadboard prototyping, which encourages the use of hook-up wires and breadboard, to make a circuit which can be easily modified later. This avoids the hassle of soldering.
3. There are a number of tutorials, tons of code, forums, etc, to help beginners.
4. The design of the board and IDE is so simple that one does not have to be an engineer to use it.
5. It is pretty cheap compared to other available development boards.
There are various versions of Arduino to choose from, such as Uno, Mega and Lilypad. I prefer the Arduino Mega, which is a microcontroller board based on the ATmega1280. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable, or power it with an AC-to-DC adaptor or battery, to get started.

- Advertisement -

Pyserial. This is a library that provides Python support for serial connections (RS232) over a variety of different devices: serial COM ports, Bluetooth dongles, infra-red ports, and so on. It also supports remote serial ports via RFC 2217 (since v2.5). We use this for communication with the external hardware (Arduino). This library is easy to use and it has good documentation.

Python. Python is a general-purpose, high-level programming language whose design philosophy emphasises code readability. Python claims to combine remarkable power with very clear syntax, and its standard library is large and comprehensive.

OpenCV installation
Let us now proceed to OpenCV installation. All commands are meant to be run in a terminal.
1. Install all pre-requisites as shown below:

- Advertisement -

 [stextbox id=”grey”]$ sudo apt-get install build-essential
$ sudo apt-get install cmake
$ sudo apt-get install pkg-config
$ sudo apt-get install libpng12-0
libpng12-dev libpng++-dev libpng3
$ sudo apt-get install libpnglite-dev
libpngwriter0-dev libpngwriter0c2
$ sudo apt-get install zlib1g-dbg
zlib1g zlib1g-dev
$ sudo apt-get install libjasper-dev
libjasper-runtime libjasper1
$ sudo apt-get install pngtools
libtiff4-dev libtiff4 libtiffxx0c2
$ sudo apt-get install libjpeg8
libjpeg8-dev libjpeg8-dbg
$ sudo apt-get install ffmpeg
libavcodec-dev libavcodec52
libavformat52 libavformat-dev
$ sudo apt-get install
libgstreamer0.10-0 libgstreamer0.10-
$ sudo apt-get install libxine1-
ffmpeg libxine-dev libxine1-bin
$ sudo apt-get install libunicap2
$ sudo apt-get install libdc1394-22-
dev libdc1394-22 libdc1394-utils
$ sudo apt-get install swig
$ sudo apt-get install libv4l-0
$ sudo apt-get install python-numpy
$ sudo apt-get install build-essential
libgtk2.0-dev libjpeg62-dev libtiff4-
dev libjasper-dev libopenexr-dev
cmake python-dev python-numpy libtbb-
dev libeigen2-dev yasm libfaac-dev
libopencore-amrnb-dev libopencore-
amrwb-dev libtheora-dev libvorbis-dev

2. Install Python development headers with ‘sudo apt-get install python-dev.’


Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components