jacbar
jacbar

Reputation: 526

Comparing position of two sets of points on 2D image

I've got question about algorithms to compare if two sets of points are in a similar place on the image.

They don't create similar shapes likes circles, rectangles etc, but they are something like irregular clouds.

For example:

The first cloud of points is learning set of desired area on image and we are checking if second cloud is in similar position.

I was thinking of drawing simple shapes to form points (like rectangles which will accumulate all points) and checking if one is in another or distance between centers of figures, but this method doesn't seem to be very accurate.

Are there better algorithms to solve this problem?

Upvotes: 0

Views: 1231

Answers (2)

LSerni
LSerni

Reputation: 57418

Sets will have quite similar shapes (it will be set of points of human skeleton from kinect > sensor) and I want to check if person is sitting in the same place as it was learned in the > first place

Then you will probably be able to derive a correspondence between two points (i.e. you will know that a given point is SHOULDER_RIGHT or ELBOW_LEFT or...). If that is the case you can simply calculate the SUM(SQRT((Xi1-Xi2)^2+(Yi1-Yi2)^2) for each i-th pair of points (X1,Y1) and (X2,Y2) (same goes if you can obtain the third dimension Z).

The value thus obtained will have a minimum of zero when the two sets of points are perfectly coinciding.

Upvotes: 0

Tanmay Patil
Tanmay Patil

Reputation: 7057

Image Moments

Don't worry about the fancy name, it's just a standard method in image processing to do exactly what you require.

Image moment of power n w.r.t. x and m w.r.t. y is actually the integration of (pixel value * xPosition^n * xPosition^m) over the entire image.

So (0, 0)th order moment i.e moment(0, 0) is actually area of the cloud.

Similarly, moment(1, 0)/moment(0, 0) is X coordinate of centroid of the cloud. And, moment(0, 1)/moment(0, 0) is Y coordinate of centroid of the cloud.

Higher order moments give additional features/information peculiar to shape of the clouds.


Now you can easily compare the arbitrary shapes.
These functions are available in opencv and matlab.

Hope this helps.
Good luck.

Upvotes: 1

Related Questions