Request: Automatic channel alignment for OSC images (StarAlignment)

johnpane

Well-known member
One-shot color images have inevitable chromatic misalignment, caused by some combination of the optics and atmospheric dispersion.

Some users attempt to correct for this in the integrated image using ChannelMatch. This does not work ideally because the chromatic errors vary across subframes (e.g., atmospheric dispersion varies as altitude changes during subframe collection), so once the image has been integrated the chromatic errors cannot be accurately corrected. Moreover, the chromatic errors are a combination of linear offsets (from atmospheric dispersion) and radial scaling (from the optics), requiring careful adjustment of both scale and offset.

Ideally, the corrections wold be done on individual subframes, using the full capabilities of StarAlignment. The user could separate the channels of each subframe, align the red and blue to green, then recombine the channels. That could be scripted to avoid the tedium of repeating these steps for each subframe, but I think this approach would not flow through in a CFA Drizzle workflow.

I propose that StarAlignment be enhanced to offer an option for OSC images, where it separately aligns each of the three color channels of each target frame to the reference frame (the green channel of the reference frame if it is a color image such as one of the subframes). StarAlignment could store all three transformation matrices in the Drizzle files so that DrizzleIntegration could replicate the channel alignment during the CFA Drizzle process.
 
Hi John,

Have you tried the following:

- Use ChannelExtraction to extract the R, G and B channels as separate grayscale images.

- Apply StarAlignment to register R and B against G with distortion correction enabled and thin plate splines registration model.

- Use ChannelCombination to rebuild the RGB color image from G and registered R and B.

This has a big advantage: you are aligning integrated channels, where SNR is much higher than on individual calibrated/demosaiced frames, so image registration can work much more accurately.

Note that image integration tools (including both ImageIntegration and DrizzleIntegration) treat color channels as independent images, so misaligned channels cannot make any difference for integration in terms of normalization, pixel rejection, etc.
 
Yes, I have tried that.

If the problem were solely due to optics and did not vary across frames, this would be a good solution. But the aberrations due to optics are composed with time-varying aberrations from atmospheric dispersion. By the time the subframes have been integrated the atmospheric dispersion component has introduced blur that cannot be corrected.
 
In such case the best option would be:

- Extract all R, G, B channels for all calibrated/demosaiced images. Use the BatchChannelExtraction script.

- Register all channel images (now you have 3 times more data to align) against the same reference, which should be just one of the channels you have extracted in the previous step. Of course, use distortion correction and thin plate splines. Local distortion is probably not needed here in general; by disabling it you save a lot of time and image registration is more stable.

- Perform three separate integration / drizzle integration tasks to generate three integrated channel images.

- Use ChannelCombination to build the RGB color image from integrated R, G and B.
 
Thank you for this suggestion. This forces using the integrated demosaiced images as the final product, rather than following through with CFA drizzle as you strongly advocated in this post:

In current versions of PixInsight, CFA interpolation with the Debayer tool is intended exclusively for generation of temporary working images, required as input for StarAlignment. The only recommended way to generate integrated color images from CFA raw data, be it data acquired with digital cameras or single-shot CCD cameras, is DrizzleIntegration (i.e., CFA drizzle, AKA Bayer drizzle). The only exception may be if you have just a marginal number of raw frames, where drizzle may not be applicable.
 
This forces using the integrated demosaiced images as the final product, rather than following through with CFA drizzle as you strongly advocated in this post:

Why? I don't see how this can prevent the use of drizzle integration. After all, all we are doing here is three separate integrations. It is exactly the same as working with three separate data sets.
 
- Extract all R, G, B channels for all calibrated/demosaiced images. Use the BatchChannelExtraction script.

- Register all channel images (now you have 3 times more data to align) against the same reference, which should be just one of the channels you have extracted in the previous step. Of course, use distortion correction and thin plate splines. Local distortion is probably not needed here in general; by disabling it you save a lot of time and image registration is more stable.

- Perform three separate integration / drizzle integration tasks to generate three integrated channel images.

- Use ChannelCombination to build the RGB color image from integrated R, G and B.

Sorry, I did not notice your mention of drizzle integration in the quote above. Can you confirm that, for example, when I use the drizzle files generated by aligment/integration of the R components of the demosaiced subframes, drizzle will draw upon only the R pixels in the cfa images to produce the corresponding R drizzle integration?

It is exactly the same as working with three separate data sets.
This is a little different than working with three separate datasets, because the original files that drizzle obtains data from have other color data in them, unlike when working with non-cfa monochrome subframes. If this will work, great! It just doesn't seem obvious that it would.
 
Before drizzle, would I have to convert the calibrated subframes into CFA RGB images, extract the R, G, and B channels, and manually edit the xdrz files to point to the appropriate ones of these?
 
I understand the problem and see how we don't have a good solution for it currently. Right now we can solve this problem for a regular integration with the channel extraction/combination strategy that I described above. However, it doesn't work well with drizzle and CFA data. Thank you for detecting this flaw in our preprocessing pipelines.

The good news is that the changes required to implement this feature for drizzle integration of CFA data are not very difficult and non-invasive. Basically, the problem can be solved with a few changes in the metadata stored in XDRZ files and a relatively simple modification of the DrizzleIntegration tool. Allow me some time to think about this. I'd like to implement this feature as soon as possible.
 
A new separate CFA channel alignment feature, including drizzle integration support, is now implemented. It will be distributed in the coming days for all platforms as a set of updates to the Debayer, ImageRegistration and ImageIntegration modules.

Thank you for your excellent suggestion and support.
 
Hi Juan, what version of PixInsight has implemented the new separate CFA channel alignment feature in Debayer, ImageRegistration and ImageIntegration? I'm still on 1.8.8-9 because the newer versions need the MacOS 12 update version to install! Do I need to free up some disc space to go to 1.8.8.12 to get the new CFA alignment feature? I wish the CFA alignment was automatic (with the distortion correction and thin plate splines)...
PixInsight is unbelievably powerful but very difficult to master. I'm still trying to get the absolute best integration routine using WBPP...
Thanks for all you do!
 
Back
Top