Funding for 'IT Lab' Project, Phase 1: Progress of sticker sales. Purchase a sticker to help us reach our target.Updated: 2010-02-28 11:53
Digital Image Processing with OpenCV

by Lahiru Lakmal Priyadarshana
Starting
from today, we will bring you a series of articles under this topic on
diGIT. In this series of articles we will try to give you some
knowledge on digital image processing using OpenCV. These articles are
especially designed for beginners in the field of image processing and
we hope that this will help anyone who is interested in image
processing, but who does not exactly know where to begin.
In
the first section of this very first article we will be discussing some
basics about digital images and image processing, and then in the next
section we will give you an introduction on OpenCV.
Digital Images and their Structure
An
image is something which is similar in appearance to another object or
a person. It can be two-dimensional, such as photographs, displays, or
three-dimensional, such as statues. In this article we consider
two-dimensional images captured using optical devices that can be
stored and used as data in digital devices.
Human eyes also see “images” of things around us. The human brain gets several signals from those vision images and collects different kinds of information about the surroundings. This allows us to examine an image carefully and identify the features of an image. But in a digital image however, a computer or another digital imaging device sees only a grid of numbers. To make this point more clear let’s look inside a grayscale image.

Pixel
is the smallest piece of information of an image. A digital image
consists of pixels that are arranged in a two-dimensional grid in which
the image is built upon. Each pixel of an image is a sample of that
image. More samples can provide more accurate information on the source
of that image.
Every
pixel has its own value. In the above grayscale image (Figure 1) the
intensity of each pixel is represented by a value from 0 to 255 where 0
is black and 255 is white. And it is a single channel image. But in
some images each pixel has three or four components, for example in a
color image each pixel has values for red, green and blue channels.
If we represent an RGB pixel in the format of (R, G, B);
(0, 0, 0) is black
(255, 255, 255) is white
(0, 0, 255) is blue
(0, 255, 0) is green
And (255, 0, 0) is red.
After
getting a digital image, in-order to identify and extract information
we must process it. This includes pixel wise processing where we
traverse through each pixel on every row in the two-dimensional image.
By traversing through pixels we can read their values or modify. These
modifications can change the brightness, contrast of an image, find
edges or change the amount of noise. Furthermore it may include image
transitions such as rotating, scaling and wrapping.
Now
you might think why we actually need to process images. To make it
easier to explain let’s look at an example where we need to identify
the registration number of a vehicle using an image of a license plate.
Even though we could recognize the number just by looking at the image,
an automated computer system could not do it that easier. We might need
to ignore unnecessary pixels and make our attention only on the
numbers. For that we may have to use an edge detection algorithm and
find the edges of the raw image. It reduces unnecessary things from our
region of interest but leave only the edges of the numbers that we need
to recognize. Then it’s easy to use some pattern recognition algorithm
to identify the numbers by checking the patterns of their edges.
Image
processing plays a major role in today’s world in many different
fields. It can be used to extract information from radar images or
satellite images in military applications, and to examine images
related to medical purposes, or it can be used to monitor images from
security cameras, for motion tracking and even for autonomous robots.
So it’s clear that the applications of image processing have a vast
perception.
Welcome to OpenCV
OpenCV (Open Source Computer Vision) is a computer vision library available from [http://opencvlibrary.sourceforge.net/].
It is an open source library written in C and C++ and runs under
Windows, Linux and Mac OS X. OpenCV has lot of inbuilt functions that
you can use for your image processing and computer vision needs. It is
mainly aimed at real time applications.
Example
applications of the OpenCV library are Human-Computer Interaction
(HCI); Object Identification, Segmentation and Recognition; Face
Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion
Understanding; Structure From Motion (SFM); Stereo and Multi-Camera
Calibration and Depth Computation; Mobile Robotics.
It
is easy, even for a beginner to use OpenCV library and accomplish their
requirements on computer vision and image processing applications. The
simple-to-use computer vision infrastructure allows people to build
fairly sophisticated and highly efficient vision applications easily
and quickly. OpenCV is free for commercial or research use.
In
order to use this library and try the code sample that we publish in
this series of articles, you should probably have some knowledge of
programming in C and C++. If you are new to these programming
languages, do not worry; there will not be any complex programs or
mathematical functions! Just try by yourself to write ‘hello world!’
programs both in C and C++ and if you have that much of knowledge, we
are sure for most parts you will not find it difficult.
In the next publish let’s see how to setup OpenCV and say “hello world!” in image processing. Till then, happy hacking! J.
-Lahiru.
Post new comment