views:

291

answers:

7

I need to evaluate if two sets of 3d points are the same (ignoring translations and rotations) by finding and comparing a proper geometric hash. I did some paper research on geometric hashing techniques, and I found a couple of algorithms, that however tend to be complicated by "vision requirements" (eg. 2d to 3d, occlusions, shadows, etc).

Moreover, I would love that, if the two geometries are slightly different, the hashes are also not very different.

Does anybody know some algorithm that fits my need, and can provide some link for further study?

Thanks

+1  A: 

Seems like a numerical optimisation problem to me. You want to find the parameters of the transform which transforms one set of points to as close as possible by the other. Define some sort of residual or "energy" which is minimised when the points are coincident, and chuck it at some least-squares optimiser or similar. If it manages to optimise the score to zero (or as near as can be expected given floating point error) then the points are the same.

Googling

least squares rotation translation

turns up quite a few papers building on this technique (e.g "Least-Squares Estimation of Transformation Parameters Between Two Point Patterns").

Update following comment below: If a one-to-one correspondence between the points isn't known (as assumed by the paper above), then you just need to make sure the score being minimised is independent of point ordering. For example, if you treat the points as small masses (finite radius spheres to avoid zero-distance blowup) and set out to minimise the total gravitational energy of the system by optimising the translation & rotation parameters, that should work.

timday
This solves the wrong problem. It starts with a known matching of each vertex to the other object's corresponding vertex. It then finds the transformations between the objects. In the submitters case, you don't have any knowledge of the pairwise matching vertices to start with... if you did, the problem becomes easy.
SPWorley
OK sorry the paper cited was a bad example as it assumes point-order correspondence. But a "closeness" score independent of point ordering can still be defined and numerical optimisation brought to bear (see update above).
timday
Yes, it's a good solution to a different problem. No, I don't think you can get anything easily from your update. Try formalizing the question you're asking and you'll see the problem (which you may be able to solve, but if you do please post that!)
ilya n.
+1  A: 

There a bunch of SIGGRAPH publications which may prove helpful to you.

e.g. "Global Non-Rigid Alignment of 3-D Scans" by Brown and Rusinkiewicz:

http://portal.acm.org/citation.cfm?id=1276404

A general search that can get you started:

http://scholar.google.com/scholar?q=siggraph+point+cloud+registration

nsanders
+1  A: 

spin images are one way to go about it.

Autoplectic
+2  A: 

Your first thought may be trying to find the rotation that maps one object to another but this a very very complex topic... and is not actually necessary! You're not asking how to best match the two, you're just asking if they are the same or not.

Characterize your model by a list of all interpoint distances. Sort the list by that distance. Now compare the list for each object. They should be identical, since interpoint distances are not affected by translation or rotation.

Three issues:

1) What if the number of points is large, that's a large list of pairs (N*(N-1)/2). In this case you may elect to keep only the longest ones, or even better, keep the 1 or 2 longest ones for each vertex so that every part of your model has some contribution. Dropping information like this however changes the problem to be probabilistic and not deterministic.

2) This only uses vertices to define the shape, not edges. This may be fine (and in practice will be) but if you expect to have figures with identical vertices but different connecting edges. If so, test for the vertex-similarity first. If that passes, then assign a unique labeling to each vertex by using that sorted distance. The longest edge has two vertices. For each of THOSE vertices, find the vertex with the longest (remaining) edge. Label the first vertex 0 and the next vertex 1. Repeat for other vertices in order, and you'll have assigned tags which are shift and rotation independent. Now you can compare edge topologies exactly (check that for every edge in object 1 between two vertices, there's a corresponding edge between the same two vertices in object 2) Note: this starts getting really complex if you have multiple identical interpoint distances and therefore you need tiebreaker comparisons to make the assignments stable and unique.

3) There's a possibility that two figures have identical edge length populations but they aren't identical.. this is true when one object is the mirror image of the other. This is quite annoying to detect! One way to do it is to use four non-coplanar points (perhaps the ones labeled 0 to 3 from the previous step) and compare the "handedness" of the coordinate system they define. If the handedness doesn't match, the objects are mirror images.

Note the list-of-distances gives you easy rejection of non-identical objects. It also allows you to add "fuzzy" acceptance by allowing a certain amount of error in the orderings. Perhaps taking the root-mean-squared difference between the two lists as a "similarity measure" would work well.

Edit: Looks like your problem is a point cloud with no edges. Then the annoying problem of edge correspondence (#2) doesn't even apply and can be ignored! You still have to be careful of the mirror-image problem #3 though.

SPWorley
it is very, very possible to have two meshes defining completely different shapes and yet having very similar interpoint distances. this is not a robust way to generate image representations. see also shape histograms: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.9487
Autoplectic
@auto, yes, indeed, if the distances lists are not identical, you may have very different point sets. But the question that is being asked is a way to determine identical sets. The "similar objects have similar hashes" is just a nice bonus heuristic but clearly not a guarantee. BTW, nice reference, I used that paper years ago!
SPWorley
The algorithm I posted below will find automatically give the rotation that transforms one set to another as a byproduct if they are same or similar (except some rare cases).
ilya n.
+1  A: 
balint.miklos
They way it's described on Wikipedia, it's still much better to get good first approximation by other means. I would use inertia tensor, for example (my answer below).
ilya n.
Yes, you are completely right, one needs a reasonable estimate to start the optimisation. Your solution steps 1. and 2. is a good approach for that. Just for your information, in principle this is a special case of the principle component analysis, which is a technique to find the dominating axes of point sets. See http://en.wikipedia.org/wiki/Principal_components_analysis
balint.miklos
A: 

Maybe you should also read up on the RANSAC algorithm. It's commonly used for stitching together panorama images, which seems to be a bit similar to your problem, only in 2 dimensions. Just google for RANSAC, panorama and/or stitching to get a starting point.

Niki
A: 

This is how I would do it:

  1. Position the sets at the center of mass
  2. Compute the inertia tensor. This gives you three coordinate axes. Rotate to them. [*]
  3. Write down the list of points in a given order (for example, top to bottom, left to right) with your required precision.
  4. Apply any algorithm you'd like for a resulting array.

To compare two sets, unless you need to store the hash results in advance, just apply your favorite comparison algorithm to the sets of points of step 3. This could be, for example, computing a distance between two sets.

I'm not sure if I can recommend you the algorithm for the step 4 since it appears that your requirements are contradictory. Anything called hashing usually has the property that a small change in input results in very different output. Anyway, now I've reduced the problem to an array of numbers, so you should be able to figure things out.

[*] If two or three of your axis coincide select coordinates by some other means, e.g. as the longest distance. But this is extremely rare for random points.

ilya n.
It's the algorithm I am using right now. The main disadvantage is that settings that are "almost the same" produce very different hashes, which is kind of annoying
Stefano Borini
You can apply a different "hash" function to an array then.
ilya n.