Stuck on Wandering Star

Back to General discussions forum

doomyxx     2015-04-12 19:37:04

I've been trying to solve this for some days.
How I think this should be solved: Align the axis of the vectors, then check which point changed position.
But I can't directly rotate the vectors because I don't have their match to calculate the rotation matrix.

What I tried doing is rotate the vectors in the first array by 1 degree at a time, and save the distances in an array. Then just check the rotated vector with the minimum distance. But this doesn't work because the axis also move, not just rotate.

Another thing I tried is pick a point, and then calculate distances to it's nearest neighbors, then try to find the same pattern in the other image. But this also doesn't seem to work. (in theory this should work, right? maybe i'm doing something wrong)

Now I'm stuck, I don't know what to do next. Any indications on some algorithms I should check out?

Thanks!

Rodion (admin)     2015-04-13 04:27:57
User avatar

Hi, thanks for your message!

> Another thing I tried is pick a point, and then calculate distances to it's nearest neighbors, then try to find the same pattern in the other image. But this also doesn't seem to work.

I believe this is a right way - what exactly do you use as a "pattern" - i.e. "invariant", which will allow to identify the star regardless of shift and rotation of image?

doomyxx     2015-04-13 09:06:41

Hello,
For the pattern I'm saving the rounded distances in an array, then search for any sequence of 3 or more which match(I also check the reverse). It does yield some results, some good, some bad, and I tried rotating it based on those results but it doesn't rotate it at the right angle, it's always a bit off.(it rotates it correctly for the matching point, as it will overlap, but for the whole array, it's a bit off, probably because the rotation point should be at the centroid and not on that point, I'll have to look more into it) I think I'll have to calculate the rotation based on all the matching pairs.

doomyxx     2015-04-13 11:08:19

Actually after looking more into the matches, they are really bad, only a few are good, not sure how I can improve it or how to filter them. Also about rotating the vectors after I found a match, I tried moving the centroid to the origin by subtracting the distance between origin and centroid, rotate the vectors, then add the distance back. The rotation is still off by some amount.

Rodion (admin)     2015-04-13 11:31:59
User avatar

>Actually after looking more into the matches, they are really bad, only a few are good

How do you compare them? E.g. for given star you calculate distances to about 5-10 closest others. Not to every other star. This way should allow you to find several matching stars easily (of course you should compare numbers applying some "tolerance", not exactly). Then you simply get the vector formed by these two stars - and calculate what shift and rotation you want to make vectors on two "images" match...

doomyxx     2015-04-13 14:04:33

Thanks! You are right, I was actually comparing to every other star, I changed it so it only compares to closest 10 stars and now finds the correct one. But after rotating it it's still off a bit. I tried finding 3 matching points, then calculate the centroids and rotate around it, still off... Now I've been trying minimize the distance by brute forcing, moving along the axis until the distance is minimum, then rotate a degree, if the rotation gives better distance, try to move the axis again, and so on. But I find that it ends up rotated too much and gets stuck.

Here's a picture of what I get: http://i.imgur.com/Rw4jwGw.jpg
A is the first image, B is the second image, Transformed A is the result after rotating A based on the found match. Edit:(actually that's the wrong image(it's the same image as B), transformed A is the blue from the overlap)

Please login and solve 5 problems to be able to post at forum