You are on page 1of 7

Image processing.

9 Firstly capturing am image from a webcam.

9 Converting RBG image into grayscale
9 Converting a grayscale image into binary
image to binary array of 1’s and 0’s
9 Extracting different colors from the image.
E.g. Red, Green or Blue
9 Edge detection.
9 Shape detection – circle.
Copyright ® IIT Guwahati
Robotics Club
Capturing Image
„ When using JAVA , JMF (Java media
Framework) is needed to grab a image
from webcam.

„ In visual studio third party API such as

veo’s API can be used to grab the
image from the webcam.
Copyright ® IIT Guwahati
Robotics Club
About Image
„ A 32bit buffered image has four layers ARGB
„ ‘A’ represents transparency (alpha)
„ ‘R’ represents RED
„ ‘B’ represents BLUE
„ ‘G’ represents GREEN
„ Value of each layer can vary from 0 to 255
„ Each component can be extracted by binary shift and
‘AND’ operation.
„ Each pixel is a 32bit integer
„ 11001100 10101001 01010101 11010101
Copyright ® IIT Guwahati
Robotics Club
Converting in Grayscale
„ Some of the operations are better applied on gray
scale image. E.g. gaussian smooth and edge
„ This is the standard formula which gives different
weightage to different colors.
„ a=0xff & img[i]>>24;
„ r=0xff & img[i]>>16;
„ g=0xff & img[i]>>8;
„ b=0xff & img[i];
„ img[i]=(int)(0.3*r + 0.59*g + 0.11*b);
„ Grayscale image can be directly converted into binary
array by applying an appropriate threshold value.
Copyright ® IIT Guwahati
Robotics Club
Edge detection
„ Laplace transformation for edge detection.
„ Convolution using a convolution kernel is a spatial
operation that computes the output pixel from an input
pixel by multiplying the kernel with the surround of the
input pixel. This allows the output pixel to be affected by
the immediate neighborhood in a way that can be
mathematically specified with a kernel.
„ Uses Convolve operation on the image with kernel matrix:
0 , -1 , 0
-1 , 4 , -1
0 , -1 , 0
to apply edge detection on the image.
„ ConvolveOp is inbuilt class in java.awt.image package.
Copyright ® IIT Guwahati
Robotics Club
Circle Detection
„ Hough Transformation for circle.
„ Takes a binary array and estimate radius of the circle and can
return the center of the probable circles in the Image.

„ In this method a circle of estimated radius is ploted on the

Hough Plane taking every edge detected points as centre.

„ Now for a circle in actual image, all the circles on the edge will
intersect in the centre of the actual circle. Thus now we have to
find a local maxima in the hough plane which gives us the
centre of the probable circle of the given radius.

„ This method is independent of noise in the image and only

estimate of the radius in pixels is required.
Copyright ® IIT Guwahati
Robotics Club
How to solve the maze.
„ Shortest path between two points with given restraints can be
found by applying “breadth first search” in the proper
representation of the graph of the given situation.
„ So first we have to model the maze into a Graph.
„ Path blocks of the arena will form the vertices of the graph.
„ We already know the source and destination vertices in the
„ So when we apply the breadth first search taking the source
block as root and can get shortest distance to every block from
the root.
„ We can even find the path corresponding to the shortest
distance by backtracking from the destination to the root.

Copyright ® IIT Guwahati

Robotics Club