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.