PixInsight Forum

PixInsight => General => Topic started by: marekc on 2013 October 25 12:21:48

Title: Another question about `Incompatible Image Geometry' in the Linear Fit tool
Post by: marekc on 2013 October 25 12:21:48
Once again I find myself running into a problem with LinearFit, and I'm curious to see if anyone might know what's happening.

I am trying to make my first two-frame mosaic. I shot the R, G, and B frames for each panel last weekend, when the Moon was pretty bright, so all of the images have fairly heavy gradients. I've worked DBE pretty hard, trying to flatten everything as much as possible. I think I have removed the gradients reasonably well.

Whether I use StarAlignment or Gradient Merge Mosaic, the results are poor. Both of those methods are able to align the panels and fit them together, but one panel looks reasonably smooth, and the other looks very noisy and grainy, in the final mosaic. It's much worse than just a visible seam. This is despite the fact that the background levels of both panels are pretty similar. (Also, I've used Frame Adaptation at all of the points where Steve Allan recommends it in his `Supermosaic' video.)

It occurred to me that since the images are still linear, maybe I should try to Linear Fit them, prior to building the mosaic. Problem is, I keep running into the `Incompatible Image Geometry' error, no matter what I do.

I have tried cropping one panel so it's the same size as the other... no joy.
I have tried Linear Fit on RGB images and on greyscale images of one color channel... no joy. (In other words, I'm avoiding the problem that I caused for myself the last time I posted about this: http://pixinsight.com/forum/index.php?topic=5212.msg35834#msg35834)

No matter what I do, I get `Incompatible Image Geometry'.

As usual, I'm probably missing something fairly basic. Does LinearFit only work on images that show the same part of the sky? Did I create an impossible situation for myself by trying to shoot a test mosaic under a moony sky?

- Marek
Title: Re: Another question about `Incompatible Image Geometry' in the Linear Fit tool
Post by: marekc on 2013 October 26 11:15:46
I think I'm starting to understand what's going on here. LinearFit does, indeed, work on two images of the same piece of sky. That will make it tricky - although not necessarily impossible - to use this tool to make one panel of an image match the other panel more closely.

It looks like Fabian Neyer and Juan had a conversation about this already:


From what I can tell, Linear Fit is designed to work with two images of the same piece of sky, which have been co-registered to each other (using something like Star Alignment). It looks at a pixel in the reference image, and asks `how bright is the corresponding pixel in the other image'? A large number of these comparisons are made, and we could imagine LinearFit as being like a person who's plotting the comparisons as points on an X-Y graph. Pixel values in the reference image might give the X-coordinates, and the corresponding pixel values in the `to-be-fitted' image would give the Y-coordinates.

Since CCDs are, in theory, linear in their response to light, we might reasonably expect that the graph would be a straight line, with some nominal amount of scatter around that line. I don't know if LinearFit does something like a linear least-squares fit, but it probably does something at least a little bit like that. Armed with a knowledge of the slope and Y-intercept of the line, it can transform the brightness values of the `to-be-fitted' image into the brightness values that they *would have had* if that image had been captured in the same way as the reference image. If either image has been stretched into the non-linear realm, then I assume all bets are off.

Given all this, I'm going to need at least some overlap between my frames - which of course I do have, since I'm mosaicking. I think a little jiggery-pokery with Star Alignment, and maybe cropping, can give me frames on which to perform LinearFit. Next, I would need to get LinearFit to tell me the operations it recommends performing on the `to-be-fitted' image. (Maybe those show up in the Process Console?) Then perhaps I could use PixelMath to alter the `to-be-fitted' image.

My remaining concern: Doesn't `Frame Adaptation' do all this? Is Frame Adaptation simply an under-the-hood version of LinearFit, applied to the overlap regions of the mosaic panels? If I'm using FrameAdaptation, and I'm still getting a bad-looking mosaic, maybe the gradients across and between my images make mosaicking hopeless.

Possible lesson that might come from all this: If it seems like a good idea to learn how to shoot and process a mosaic during bright-Moon time... errrr, maybe not so much.

- Marek

Title: Re: Another question about `Incompatible Image Geometry' in the Linear Fit tool
Post by: georg.viehoever on 2013 October 26 15:04:23
I think your idea about LinearFit is right: it does a linear regression to find the offset and scale factor, and then applies these to the target image. No need to use PixelMath to actually apply those factors.

And yes, FrameAdaption under the hood just does the same thing.

If you still see seams between the images, you should try GradientMergeMosaic to combine them. Search the forum and youtube for some hints on its use.
Title: Re: Another question about `Incompatible Image Geometry' in the Linear Fit tool
Post by: marekc on 2013 October 26 16:56:20
Hi Georg,

Thanks very much for the update on LinearFit and GradientMergeMosaic. Unfortunately, neither StarAlignment nor GradientMergeMosaic was able to make my mosaic work. No matter what I use, the two panels of the mosaic look very different from each other. One has a reasonably smooth background, without a lot of noise, and the other one has a really noisy background, and is stretched more. Neither Frame Adaptation nor GradientMergeMosaic seems to be able to handle the differences between the images, even with the use of Frame Adaptation.

This is despite following closely the workflow shown by Steve Allan in his `Supermosaic' video on the Pixinsight Youtube channel. That's the video where he shows how to use GradientMergeMosaic.

I suspect that either I've missed something subtle, or a moonlight gradient makes it impossible to shoot a 2-panel RGB mosaic, at least with my particular imaging system. Oh well, it was basically for practice anyway. A darker sky might have yielded more useable data.

- Marek

Title: Re: Another question about `Incompatible Image Geometry' in the Linear Fit tool
Post by: pfile on 2013 October 26 17:18:32
i guess you could post the images and people could try and see what's going on…