Image Processing : Basics


Technovanza ’09 ( my college technical festival) has an event on image processing.

What is image processing ??

Well, imagine this : There are two dice. You roll one. The webcam reads it. You write a program that reads what you’ve thrown, then a robotic arm controlled by that program turns the other die so that the sum of numbers on both of themis 7 (Why 7 ?? Try to figure it out yourself)
Well, that would be very,very tough indeed. The event I am talking about does not need all that (sigh of relief !!)

All we have to do is read the numbers on two dice and print their sum on the computer screen. Simple ? Think again.

This would encompass the following skills:
1. Knowledge of how images as perceived by a camera and a computer
2. A manipulative brain 😉
3. Programming skills

Its not easy, and its definitely not short. Too much to explain in one go.I’ll try and explain all that I learn along the way.

Images are perceived by a computer in units of pixels. The image processing software (MATLAB) stores information about these pixels as a multi-dimensional array. The array is represented as (a X b X c) where a is the x-co-ordinate of the pixel on the screen, b is the y-co-ordinate and c is usually 3.

Why 3 ? Because the coloured image is broken up into three constituent colours : Red Green and Blue. Every colour is a mixture of these three in different proportions. So the ‘3’ in the array consists of three numbers for each pixel, which signify the amount of Red,Green and Blue.
The amount of each colour component is signified by a number between 0 and 255, 0 signifying absence of that colour and 255 signifying the maximum possible. For white the RGB value will be (255,255,255) and for black will be (0,0,0). One useful piece of information is that there are only 8 colours possible if the values of the components are either 0 or 255. Also, a very basic approach when analysing images would be to change the colour of the part we are interested in to black and the rest into white, or vice versa.

Here’s an image I worked upon :

Here’s the finished image :

The patchy red part on the right is because the white tiles whould have become black along with the white dots on the die, leading to undesired results.

I think this is all one needs to know before starting programming. However, I will edit this post if and when there is need.

I will discuss the further part, mostly programming, in further posts. Programming and processing will be done using MATLAB.

For theory on colours in digital systems, visit Wiki. Read up the terms chroma and luma.

Links :

1. TUDelft Website

2. Image processing tutorial by Nex Robotics