Thursday, November 10, 2016

*** Error: Current image height differs from first image height. - When using GradientMergeMosaic

For my bubble nebula images, I followed again the tutorial from LightVortexAstronomy for creating mosaics. It worked all well until I wanted to merge the first two images and received the following error:

*** Error: Current image height differs from first image height.
<* failed *>

And upon closer inspection of my two Ha images, it turns out that one has a dimension of 9561x11410 and the other of 9561x11409 (i.e. one row less then the first one). I read about it and it turns out that this can happen when StarAlignment tries to align my images with the rough mosaic and through corrections, the resulting image "sticks" a little out. When looking at my rough mosaic:

You can see that the image on the lower bound and lower left and upper right comes right to the end. I.e. it's easy that individual pixels can be moved over resulting in two images that don't have the same dimensions.
Some people recommend to fixing it by just use the Resample process to adjust the dimensions of one image to the other. I didn't like the idea to needlessly shift the image by a column/row and loose some accuracy in the data.
After trying various ideas, I realized that I can fix this by just making the rough mosaic image a little larger:
Extended image (using DynamicCrop)
This is easy using the DynamicCrop process and dragging the borders outwards.

Now, when aligning the rough mosaic with the individual images, the dimensions are the same - plus some black borders around the image:

But the dimensions are the same! And now I can use GradientMosaicMerge to merge them together to one larger image:

And then I can crop all the dark borders out. Voila!