Author Topic: DeBayering Misregistration?  (Read 6241 times)

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
DeBayering Misregistration?
« on: 2015 November 10 08:54:02 »
Hi,

I'm a former IR photometrist so, many years later, imaging is a bit new to me. But I have been looking carefully at the process of de-Bayering an OSC Canon EOS 6D. My magnified star images tend to show a bit of chromatic aberration on them, but it is just the opposite direction from the actual chromatic aberration. I'll explain:

When I adjust the focus of the lens in a 10x magnified live view mode, the out of focus ranges as I move toward infinity focus, with red halos, followed ever so briefly by red halo on left, blue halo on right, then blue halos at the focus beyond infinity. I try hard to (manually) adjust the focus for best compromise when both red and blue halos are present. (Astigmatism?)

But my deBayered images at magnification tend to show blue on the left, and red on the right.

After thinking about the process of deBayering, and the placement of the RGGB Bayer matrix color channels, it seemed to me that we actually need to split out the individual pixels, register them, then recombine under some mixing scheme. There are 2 green pixles for every red and blue . I could average the two registered greens together, or use one as a luminance channel. Suggestions?

Just my (possibly misinformed) observations...

- DM

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: DeBayering Misregistration?
« Reply #1 on: 2015 November 10 09:33:09 »
this can be done - if you use superpixel debayering and then split the channels you'll get 3 mono images but the green channel will have averaged together the 2 green pixels behind the scenes.

there is a script called BatchChannelExtraction that can split your superpixel debayered files in a batch.

i think you can use the SplitCFA process to get 4 images from your bayer images if you want to work with the 2 green channels independently. if you want to do that as a batch you'll have to load all the images into an ImageContainer, then drag a SplitCFA process icon onto it.

rob

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #2 on: 2015 November 10 10:02:49 »
Yes, thanks for the advice on batch processing. I actually did that procedure by hand on one test image.

But on closer inspection, when I pulled up a conventionally processed VNG deBayered image, it looked pretty good under magnification. But then I realized I was examining the center of the image by default magnification, and I had been looking previously at an object quite far off axis in the previous image.

So then I did an Aberration inspection, and surely enough, I'm seeing increasing color separation at far off-axis positions, with an azimuthal dependence on the left-right location of red vs blue. In other words, the red-blue fringe is radially symmetric. So, on some areas it will match my physical experience, and on opposite locations it will appear backwards.

In the end, the VNG color recovery seems to work very well.

(Sorry for kicking up the dust.)

- DM

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: DeBayering Misregistration?
« Reply #3 on: 2015 November 10 11:32:06 »
There tends to be residual colour fringing around stars and features when shooting OSC regardless of any physical CA.  Bayer Drizzle is an effective method of mitigating this effect, assuming you have sufficient well dithered subframes.  There are various methods of implementing it, including through the batch preprocessing script.  If you want to use the full set of calibration, registration and integration tools the take a look here:

http://pixinsight.com/forum/index.php?topic=9218.0

It is worth installing the new script just for the documentation which explains the background and the Bayer Drizzle workflow in detail.

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #4 on: 2015 November 10 15:57:03 »
Thank you for that additional information. I had been using drizzled stacks of short duration exposures on previous nights - up to 60 frames of 1-min exposures. Then last night tried out a 15-min unguided exposure. The mount here is really that good, and I found that the sky glow and dark current amounted to a bit less than half of full well capacity. So presumably, I could push the exposures to 30 mins.

But that removes the possibility of drizzling stacks of images. Still finding my way around in imaging. While a 30 min photometric run might be useful, it might also be counterproductive in imaging. I just don't yet know the boundaries of imaging parameters. One thing I'm finding is that long duration exposures opens me to the negative possibility of recording lens flare from bright field stars. That didn't seem to happen with the stacks of short exposure images. And so that tells me that long duration exposures really do capture much more information that a whole stack of equivalent duration short exposures. Somewhere in between must exist a happy compromise.

- DM

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: DeBayering Misregistration?
« Reply #5 on: 2015 November 10 17:52:35 »
30 mins is not unusual for a slowish scope and narrowband filters...

rob

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #6 on: 2015 November 11 02:27:53 »
Not sure what you'd call a slowish scope.

I'm using a Canon F2.8 200mm fl + IDAS LPS D1 filter on a stock Canon EOS 6D sensor. To me that 70mm aperture seems very much on the slow side, because I'm accustomed to photometric light-buckets where aperture rules. But F2.8 is the same no matter how big or small the telescope, and that's what dictates extended-source sky-flux, isn't it? Something about the conservation of A-Omega? My pixels are 7 arcsec square.

As for narrowband filtering? The LPS D1 probably wouldn't qualify, as you likely mean something like a narrow-band H-alpha filter?

And then the QE of the CMOS sensor is below 50% tops.

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: DeBayering Misregistration?
« Reply #7 on: 2015 November 11 05:53:21 »
Not sure what you'd call a slowish scope.

I'm using a Canon F2.8 200mm fl + IDAS LPS D1 filter on a stock Canon EOS 6D sensor. To me that 70mm aperture seems very much on the slow side, because I'm accustomed to photometric light-buckets where aperture rules. But F2.8 is the same no matter how big or small the telescope, and that's what dictates extended-source sky-flux, isn't it? Something about the conservation of A-Omega? My pixels are 7 arcsec square.

As for narrowband filtering? The LPS D1 probably wouldn't qualify, as you likely mean something like a narrow-band H-alpha filter?

And then the QE of the CMOS sensor is below 50% tops.

Ah our old friend the f-ratio myth. The number of photons gathered by the optical system if a function of aperture alone. You clearly already understand this in respect of stars; since they are point sources all the photons end up in one place on the detector regardless of focal length.

When it comes to extended sources, provided the object fits on the sensor then varying the focal length will not gather new photons or lose them. (Of course if your target doesn't fit on the detector then decreasing focal length will bring new photons on to the sensor but that doesn't affect the parts that were on the sensor to begin with).

There is be some effect on SNR due to having more signal on a pixel vs, readout noise, but frankly with a Canon DSLR it isn't straightforward to apply CCD theory to a CMOS sensor where the camera preprocesses the image before it is written in to the RAW anyway.

At about 10 to 15 minutes shooting broadband ona Canon you're in the right sort of ballpark. No need to go shorter unless the local light pollution makes it necessary, but 30 mins is likely too long as you will get star bloat and not have enough subs for drizzle to work, or even the better rejection algorithms.

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #8 on: 2015 November 11 10:36:04 »
First off, thanks for setting me straight on the myth... Of course you are correct.

But now, back to something related to the mis-registration topic... The following pic is a screen grab from the central region of an image, split from the Bayer matrix into separate R,G,B images. As you can see, the mis-registration effects really aren't mis-registration at all, per se. Rather the focus of the image is best in the G channel, and gets worse to either side, with R showing the worst behavior.

I have tried repairing the R image with Deconvolution, though I'm a bit unclear whether that synthetic PSF is the target for cleanup, or the estimated blur function in the dirty image. I need to run some tests on synthetic delta functions to see better. At any rate Deconvolution didn't help very much, no matter what parameters I gave.

Unsharp masking in the R channel was better, but too severe, and tended to leave red halos as a result of the de-ringing.

What finally seemed to help a bit was mere morphological Erosion. That seems a bit grotesque to me, but I probably shouldn't take umbrage at such things since my sensor is hardly linear anyway.

But here is my question. I see from the individual channels that my focus is about as good as it can get, perhaps a bit more to the red side would help. But neither the red nor blue will be in focus when the green channel is best. Do you more experienced imagers forego such things as OSC's in favor of monochrome sensors and filter wheels? Is trying to use an OSC a joke?

Or maybe OSC's are okay, provided you don't look too closely? But the effect of these defocusings is to cause a green or red cast to the image as a whole, that does not seem undone by image background uniform-izing and color calibration. Numerous fainter stars have ruddy halos, and the really faint ones in the background are green.

- DM

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #9 on: 2015 November 11 22:06:18 »
As a follow up, I ran some exposures tonight with the aperture stopped down by various amounts. I found that operating at F:8 and higher (3+ F-stops) essentially disposes of the aberrations: coma, chromatic, edge defocus, and inter-channel (R,G,B) defocus. No more ruddy borders on moderately bright stars, no more green background stars.

Offline IanL

  • PixInsight Addict
  • ***
  • Posts: 116
    • The Imaging Toolbox
Re: DeBayering Misregistration?
« Reply #10 on: 2015 November 12 01:18:07 »
As you've identified, the optics are the key to the colour halos. The critical focus zone for a given wavelength gets smaller at lower focal ratios. So at f2.8 you are looking at a CFZ of 25 microns,  20 and 18 for R, G and B respectively. At f8 it is 203, 159 and 148.

Thus for cheaper and thus less well corrected optics the out of focus wavelengths cause less issues at higer f ratios as you have found. The answer is a good triplet or to go for a mirror-only scope, or stick to higher f-ratios and don't look to closely! A bit of care in processing can minimise the issue but never quite eliminate it.

 A mono and filter setup is the other option but getting a CCD and filter wheel to work with a camera lens can be challenging due to the lack of back focus so do your reasearch before leaping in.

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #11 on: 2015 November 12 07:48:20 »
Very much appreciate your advice. Thank you.

I have on previous order another OSC (unfortunately), but this one will be an AITEK cooled CCD, attached to a HyperSky prime focus arrangement on an 8 inch SCT with a remote micro-focuser. Still not quite the pure reflective optical train, but fewer lenses to pass through. Should be about 64 times faster than my 200 mm lens at F:8. The question is, will it produce equally aberration-free images? We shall see.

(the F:8 image quality was superb and delightful. But alas I ran some image stacks last night and found in pre-processing that I had been looking through a sucker hole with high clouds. )

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #12 on: 2015 November 12 07:59:47 »
BTW... I found the source of the "F-ratio Myth"...

Optics theory dictates that under ideal conditions A * Omega = lambda^2. But while that A is the aperture, as before, the Omega refers to the size of the central disk of the diffraction pattern, not the size of a pixel. It is a mis-application to involve the pixel size here. What this *can* tell you is the size needed for your detector in order to obtain the majority of the energy in the diffraction pattern.

- DM

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: DeBayering Misregistration?
« Reply #13 on: 2015 November 12 09:00:09 »
I feel I need to counterpose these incorrect f-ratio discussions. The Dragonfly Telephoto Array probes below 32 mag/arcsec^2. It does this by exploiting low f-ratio, and NOT by high aperture. See the reference and quote below.

Thanks,
Mike

R. Abraham and P van Dokkum, "Ultra Low Surface Brightness Imaging with the Dragonfly Telephoto Array", Publications of the Astronomical Society of the Pacific, Volume 126, issue 935, pp.55-69, 01/2014.

Paper here

Quote: The optics of a low surface brightness-optimized telescope should have the following characteristics: no reflective surfaces, because dust and micro-roughness on metallic coatings backscatter light into the optical path; an unobstructed pupil, because any central obstruction causes diffraction which moves energy into the wings of the PSF; nearly perfect anti-reflection coatings, so that ghosts and flaring do not strongly pollute the focal plane; and a small (fast) focal ratio, as the imaging speed for extended structures much larger than the resolution limit depends on the focal ratio, not the aperture.
« Last Edit: 2015 November 12 09:06:09 by mschuster »

Offline dmcclain

  • PixInsight Addict
  • ***
  • Posts: 117
Re: DeBayering Misregistration?
« Reply #14 on: 2015 November 13 10:20:26 »
Yes, I have been around the merry go-round for two days now. At first I thought the characterization was a myth based on my radio astronomy antenna design theory. But after looking more carefully, I now have to conclude that the "F-ratio Myth" is not a myth.

For the same F-ratio, a telescope with a larger aperture will necessarily have a longer focal length. Assuming the extended source fits entirely on the detector for big and small telescopes, then the integrated photometry from the whole sensor will be a huge win for the bigger telescope. But the per-pixel integrated energy goes as 1 / fl^2 because the plate scale is bigger by fl. Total energy grows as D^2 for aperture diameter D. But the per-pixel effect n any system becomes D^2 / fl^2 = 1/F^2 (F-ratio F).

Hence for the sake of pretty images of extended source background objects, the size of the telescope does not appear to matter. Only the F-ratio. And hence it is not a myth.

Take a hint from terrestrial photography where, when changing lenes, the exposure remains the same for the same F-stop setting.

:-) DM