Tuesday, December 14, 2010

Number Plate region extraction

After a long break I started writing about my image processing studies.This time KD came with a project to extract number plate region from an image. The advantage of my method over other methods are the following.
1. fast processing
2. It can give you multiple regions in image if more than one number plate present
3. It can handle image rotation up to a certain degree( +- 35 ) .I used Eigen vectors.
4. No third party libraries like openCV or aforge ( yes some times i like to reinvent the wheels again )

See the video to see the project in action.

Although the number plate extraction parts works pretty good , I don't have a good OCR module. So i am having troubles to extract numbers from image. I tried using a simple back propagation neural network, its quality of recognition is not that great.Now i am trying to develop a rotation,scale invariant  recognizer. It may take another 9 or eight months to do that. But if it works i think that would be a great achievement. I will try to post more updates here.. 

If you know any good optical character recognition library, please let me know. 

Saturday, June 12, 2010

Calculating the reflected ray/vector

In computer graphics applications its often needed to calculate the reflection ray for example if you are writing a ray tracer, a shader for some advanced lighting , or environment mapping etc.

If you are writing shaders , there are standard library function to do that . In cg shading language there is a function reflect(also its more efficient than writing our own).

In this post rather than just giving the vector formula for reflection ray , i am trying to explain the simple mathematics behind that.

See the following image, I is the original ray, and R is the reflected ray which we need to found.N is the normal of the incident plane. P is the line perpendicular from normal to both rays. it is obvious that at both ends the length of P will be same.

Dot product between two unit vectors gives the cosine of the angle between them. So using this idea we can find

R = DotProduct[ I, N ] * N + P . ---> Eq(1)

We don't know P now. But I + P = N * DotProduct[ I,N].

So by rearranging P = N * DotProduct[ I,N] - I. Substituting the value of P now in equation(1) gives the final equation.

Here it is the final equation R = 2 * N * ( DotProduct[ I,N] ) - I

Tuesday, March 16, 2010

Color Image Segmentation using Meanshift Algorithm

The meanshift method can be used to segment color image. In this method image pixels is treated as points in color space.In each iteration the meanshift vector is calculated for points which are inside the kernel radius.After that the the old kernel location is changed to meanshift vector's position. Color is also updated. This process continues untill both converge.

Original Image

Meanshift Filterd Image

As the iteration count increases , the same color segment which has same type of colors will get merged together. You can see the effect of meanshift filter on sachin's photo.Its like water painting (not exactly,there are other filters for that. )

Thursday, March 11, 2010

How to check a Point inside a Triangle

When i started to learn vector mathematics , i had found many methods to determine whether a point is inside a triangle or not.Easy method is not the fastest. This type of calculations are very important for making a fast graphics library.
Following are the methods which i remember now.
1. Using Cross Products
Take cross product between each triangle edge and the point to check. If the direction of cross product result is for the three edges that point is inside the triangle , otherwise not

2. Using the angle between the vectors made by point and triangle coordinates.If the sum of angle is 360 the point is inside , otherwise not.

3. Using Point and Plane test.See the figure. You need to know plane equation to understand it.

4. Using Bary centric Coordinates
This is the fastest of above. It involves checking the point in Bary centric coordinates system.

Friday, February 19, 2010

Real time motion segmentation

Motion segmentation is one of the greatest challenges in computer vision. Accurate real time segmentation is difficult to achieve with ordinary camera. Using 3D camera we will get much better approximation .but 3D camera is costly.

i had done edge based motion detection , now i just did chain method of clustering on the edges to group the edges in to different groups. Its not accurate yet. with ordinary 2d camera it is difficult to cluster objects due to the perspective effect. But it can give better results if we could place the camera in somewhat higher position compared the the objects.

see the videos here.. ( edges in a group have same colors )

Updated motion segmentation , see the results in video below. I need to remove the noisy segments. Noise segments are created due to the illumination changes. Hopes it can be done with some pixel modeling schemes.

Wednesday, February 3, 2010

Boundary Approximation

I have been playing with snakes( aka active contours ) for a quite long time.
Basic snake is not able to detect boundary correctly. But it is very fast.

I tried to extend the gradient vector field of the image using Laplace equation. it works. But it takes a few seconds to generate the vector field.. :( , now i am thinking about using distance transform to generate the vector field.

See the video below to see snake in action.