quatrope / astroalign

A tool to align astronomical images based on asterism matching
MIT License
140 stars 44 forks source link

astroalign.MaxIterError: List of matching triangles exhausted before an acceptable transformation was found #91

Closed timegate closed 1 year ago

timegate commented 1 year ago

I tried to align below 2 images, but I get an error "astroalign.MaxIterError: List of matching triangles exhausted before an acceptable transformation was found." source SavedView target ea1

I thought it was because it has too much candidates, so I tried a source image with fewer stars source2 stellarium-003 (2)

But the same error happened again (changing source <-> target also showed the same error).

Could you please explain why it doesn't work? or is there any workaround?

martinberoiz commented 1 year ago

I see. This problem is most likely due to all the extra space in the target image that has no correspondence with either of the sources --i.e. the field of view of both is quite different.

I think masking the region of interest (masking out the extra space) could be a solution. This is related to #90. I'll try implementing this ASAP and we can try again with masking.

timegate commented 1 year ago

Wow, thanks for fast and kind reply. I got the point exactly. Thanks so much.

Umm.. I hope that we find a way to align 2 images regardless of fov. I found that astrometry finds WCS well regardless of fov, so maybe it would be nice to leverage the two WCSs found so that the aligning works regardless of fov.

timegate commented 1 year ago

Maybe 1. Astrometry -> 2. Astroalign with known stars (https://astroalign.quatrope.org/en/latest/tutorial.html#if-you-know-the-star-to-star-correspondence) could be one way. How do you think about this way?

martinberoiz commented 1 year ago

Sure, if you want to involve WCS, I would recommend solving it with astrometry.net and then use something like reproject to do the mapping.

Extra note: Once you have the WCS, there are better tools to do the re-mapping, reproject being one. Astroalign may not be the best in that case.

timegate commented 1 year ago

Thanks for enlightening me. I learned a lot and I'll give it a try. Thanks so much!