quatrope / astroalign

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

Best guide to use for a mosaic?? #93

Closed mconsidine closed 9 months ago

mconsidine commented 9 months ago

Apologies in advance if I have overlooked something obvious. This isn't really an issue, per se

I am trying to create a mosaic of two images, where the resulting image is the combination of the two original images, but without any cropping.

I can get the registered image from the examples I've seen, but I can't seem to get the resulting combined image.

Have I overlooked a parameter that turns off the cropping so that the result has dimensions covering the original as well as rotated/transformed image? I got the test_align.py script to execute without error. If there is something in there I should build upon, I'd appreciate a pointer.

TIA, mconsidine

martinberoiz commented 9 months ago

Hi,

To create a mosaic, you can pad the target image with a pad region large enough to contain the transformed image entirely. Then before you call the register method you mask the original target region as explained here:

https://astroalign.quatrope.org/en/latest/mask.html#selecting-regions-with-masking

I think that should work. Let me know if you need more help.

mconsidine commented 9 months ago

Thanks for that. I'm working with two color fits images. So after selecting one channel out of each and adjust the histogram to knock down the number of stars, I get a transform that seems to work. Except that I really need to extract that transform, apply it to the original source image and then coadd the two I think.

The resulting 'registered' file, when written to first, is very large. Is there a bounding box function available that would help trim off what is unnecessary?

Thanks again for your help and for the package. mconsidine

martinberoiz commented 9 months ago

Astroalign itself does not have any tool to downsample or trim images. But you can do an easy trim using numpy array slicing on the registered ndarray or astropy Cutout2D if you need to maintain the WCS info as well.

I'm not sure if this answer your question.

mconsidine commented 9 months ago

It does answer my question - thank you. And I seem to generally have things working out, except that I can't quite get the masking right to include both the target and the source. The source is correctly positioned inside a larger padded image, but the target image hasn't come through. If you have a further example you can point me to, I'll pull this apart. I'm very appreciative of the help you've given already. Rgds, mconsidine