Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

Colour Matched Flats - A Case Study

  • Please log in to reply
70 replies to this topic

#26 Guest_11558

Guest_11558

    Skylab

  • -----
  • Posts: 4,276
  • Joined: 06 Sep 2017

Posted 06 December 2019 - 06:27 AM

Quite some time ago I made some test with colored flats for OSC. Reason being I was concerned about the noise in the red channel. I'm using an Aurora EL flat by Gerd Neumann and that thing is really blue. Neumann says this is intended to match the color of the sky. The result is a very weak signal in red in an otherwide well exposed OSC image. So I ordered 1/8 orange Lee foil, the sort that is made for daylight to light bulb conversion. I opend the flat panel and stacked as many as needed between the actual EL foil and the diffusor until the color balance was better. It is still not perfect but the red level is reasonably higher than it was before, using longer exposures of course. I have never seen any kind of color gradient since I use the flat panel. Like you I alway to background extraction at function degree 1, subtraction, because for the small patch of the sky that my telescopes can see the sky gradient can be approximated by a linear function. I think you should clearly distinguish between vignetting correction which is done by good flats during the calibration process and gradient removal in post processing. I have processed a lot of other CNer's data who do not care about flat at all. When there is a lot of nebulosity in the image PI will 'correct' the nebulosity alongside with the vignetting when background removel is used (abused?) for correction of vignetting.

 

Mark, how do you measure the sky background? From images or do you have a sky quality meter? I'd like to know what bortle I really have. Clearoutside estimates 4 for my location. I'm surprise you find 3 in the UK. I doubt there is any Bortle 3 nearby for me. Sigh.



#27 whwang

whwang

    Fly Me to the Moon

  • *****
  • Posts: 5,179
  • Joined: 20 Mar 2013

Posted 06 December 2019 - 07:49 AM

My naive imagination is that if electrons can somehow propagate/affect neighboring pixels, then it’s end result should somewhat look like blurring. This creates local flat errors but should not lead to global nonlinear behavior.

Also, if we assume the effect you see on Z6 is similar to what I saw on D800/D810A, crosstalk cannot explain why it goes away after hacking D800’s firmware.

#28 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 06 December 2019 - 10:28 AM

I have another interesting Nikon Z6 finding from an experiment I performed when investigating the digital scaling that causes the rings in the blue and red channels.  I wanted to uniformly illuminate the sensor, so I put an LED at a distance of 15 metres in the dark and took an image with no lens in place.  Bizarrely this resulted in green channel vignetting of around 8% intensity at the periphery even though the rays of light from the LED were parallel to within a fraction of a degree.

 

Since then I have read that the microlenses at the periphery of the sensor are offset to reduce the amount of pixel vignetting from the closely mounted lens - the offset allows them to capture more light from rays approaching at an angle.  If true, maybe it explains the vignetting seen in my experiment. Maybe the offset microlenses also affect the crosstalk at the periphery, so the amount of crosstalk (and consequent colour channel mixing) varies across the sensor.

 

Spatially variant crosstalk is a potential explanation for the weird behaviour of my flats.

 

Mark


Edited by sharkmelley, 06 December 2019 - 02:15 PM.


#29 dayglow

dayglow

    Ranger 4

  • -----
  • Posts: 360
  • Joined: 15 Aug 2013

Posted 06 December 2019 - 02:37 PM

That was rather a clever experiment you did and it brought out a detail about the sensor design that I (naively) would never have suspected.

 

Now it has me wondering as to the extent that mono sensors could also have offset micro-lenses.

 

Even for the smaller sensors used in AP that originated in security cameras the manufacturer could have been motivated to accommodate steep entry angles given the wide angle lenses so often employed for surveillance.

 

-- David F.



#30 jerryyyyy

jerryyyyy

    Surveyor 1

  • -----
  • Posts: 1,676
  • Joined: 06 Oct 2011
  • Loc: Stanford, California

Posted 16 May 2020 - 12:55 PM

Well, I now find this discussion fascinating since now that I have traded in my fl 500 180 ED for my fl 912 Stellarvue (see icon) I discovered that I could mount my unmodified D800 right on top and it guides perfectly by just dropping one counterweight a bit. 

 

But now I have entered "Flats Hell" for the D800.  I have found that the T-shirt approach works best for me, but I have only ben working on this for a couple days... I know Wei has been working on it for years. 

 

The upper left are the images processed with bias and darks (no internal dark from camera)… you would think you could remove that vignette… talk about symmetry. This is the F 1.4 50mm lens. 

 

The right upper one is with the T-shirt flat (which is below it)… looks like too much was removed…

 

I can make it sorta cleaned up with ABE, but you would think you could get this to work.  I can always just crop, but I would like to get as big an image as possible. 

 

I also made a synthetic flat (bottom left).  Does not perfectly clean up the image either. 

 

Maybe I need to get some new flats with a lower ADU… I was shooting for around 25000 like I use for the CCD. But that seems way brighter than the lights….. however seems many more factors at work here.

 

Is the solution that Wei suggests to get that firmware hack????

Attached Thumbnails

  • D800.jpg


#31 Guest_11558

Guest_11558

    Skylab

  • -----
  • Posts: 4,276
  • Joined: 06 Sep 2017

Posted 17 May 2020 - 02:38 AM

I have another interesting Nikon Z6 finding from an experiment I performed when investigating the digital scaling that causes the rings in the blue and red channels.  I wanted to uniformly illuminate the sensor, so I put an LED at a distance of 15 metres in the dark and took an image with no lens in place.  Bizarrely this resulted in green channel vignetting of around 8% intensity at the periphery even though the rays of light from the LED were parallel to within a fraction of a degree.

 

Since then I have read that the microlenses at the periphery of the sensor are offset to reduce the amount of pixel vignetting from the closely mounted lens - the offset allows them to capture more light from rays approaching at an angle.  If true, maybe it explains the vignetting seen in my experiment. Maybe the offset microlenses also affect the crosstalk at the periphery, so the amount of crosstalk (and consequent colour channel mixing) varies across the sensor.

 

Spatially variant crosstalk is a potential explanation for the weird behaviour of my flats.

 

Mark

I think this is the case. A typical camera lens' exit pupil is close to the sensor compared to a telescope.

I still have no answer why my Ha flats and my O-III flats look different using the mono DSLR that has not got any micro lenses.



#32 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 18 May 2020 - 01:28 AM

I still have no answer why my Ha flats and my O-III flats look different using the mono DSLR that has not got any micro lenses.

That does sound odd.  Colour variations with a mono sensor won't be caused by pixel crosstalk.

 

Mark



#33 Guest_11558

Guest_11558

    Skylab

  • -----
  • Posts: 4,276
  • Joined: 06 Sep 2017

Posted 18 May 2020 - 04:26 PM

I guess it is interference in the thin layers of the sensor. It is a major problem in professional color measurement. The camera's sensitivity bounces up and down within just a few nm change in wavelength when interference comes into play. As it depends on the angle the light comes in it looks like a good theory to me. But I have no way testing it out. Well, maybe with "my" new TLS.....



#34 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 29 August 2020 - 06:46 AM

After my struggle with the flats and short shutter speeds (https://www.cloudyni...h-bright-light/ ), I got the EL-panel I mentioned in that thread, and as it was too bright and on the cold side, I added a Lee #208 film, which is a combination of neutral gray and warming filter and gives shutter speeds between 1/2 and 1/10 second at f/4.5. The resulting color leans slightly towards green though. I attached the high voltage unit to the back of my EL-panel so that I did not have any loose cables that would crack in the cold when I rotate the panel 90° on the lens shade between each flat exposure. 

 

p3968100133.jpg p3968143190.jpg

 

In addition to the Lee filter I have a two milky Plexiglas plates of which one is sandwiched to the Lee filter/EL-panel with double sided tape and the other is currently loose so that I can add additional filtration below it to color match my flats. So far I only used some makeshift filters of purple anti static foam and one or two layers of blue plastic film. They work surprisingly well with respect to uniformity of the flats, and the latter (lower right below) is likely the one closest to the background sky these times with more and more LEDs taking over light pollution.

 

300mm f/4 PF f/4.5 front aperture                           300mm f/4 PF  f/8 Lee filter/1 layer of Plexiglass on EL-panel

p3967405860.jpgp3967407164.jpg

 

Flats with f/4.5 front aperture, green, pink, blue, violet mix.

p3968072426.jpg p3968072429.jpg

 

p3968072428.jpg p3968072430.jpg

 

Continued in next post....

 

 



#35 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 29 August 2020 - 06:46 AM

....Continued form last post

To test these I chose an imaging session from a quite uniform part of the sky during my PANSTARRS capture in February.

Below left is 55 exposures stacked in DSS with the green flat, and light pollution subtracted and stretched in CNX2. To the right a single exposure.

 

p3968177326.jpg p3967391182.jpg   

 

Not so surprising that there is a green center to red periphery circular gradient considering the title of this thread (reds look stronger in the full sized image).

 

Then a try with the violet mix flats, closely matched to the background sky to the left. There is still a circular gradient with raw files, flats, darks and biases stacked in DSS, but resulting in green and red now reversed compared to above. To the right below I tried to apply a flatfield file in RawTherapee based on 8 multiple exposures in my D500, output 16 bit TIFF files which was then stacked in DSS and output as 16 bit TIFF without adjustment and further corrected and stretched in CNX2. That worked surprisingly well, there is mostly only a left to right gradient in the night sky but some color shift in that gradient. 

 

p3968177327.jpg p3968177325.jpg

 

 

Another imaging session with D7100, a very lousy Pinwheel series of exposures in moonlight pushing background toward blue.  Single short:

p3967400551.jpg

 

Then DSS with raw flats applied, order of flat backgrounds green, blue, violet mix:

 

p3968188345.jpg p3967400552.jpg

 

p3967400554.jpg p3967400553.jpg

 

The last one is also 4 flats averaged in D7100 using multiple exposure mode, and used as flat frame in RawTherapee. The TIFs were stacked in DSS, output without settings applied and then light pollution subtracted and stretched in CNX2. Again the flat frames in RawTherapee do not cause the same degree of circular artifact, just the remaining gradient and dust motes. I also tested stacking raw with the green flats in Sequator, but I again got the circular artifacts.

 

Continued in next post....


Edited by otoien, 29 August 2020 - 07:04 AM.


#36 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 29 August 2020 - 06:47 AM

...Continued from last post

 

So the question is then if the application of the raw flats per channel as in DSS (I checked the GitHub source to confirm that) is somehow broken. To test this I processed a series of exposures made with the milky plexiglass plate at dusk against the greenish upper left flat above. Then I also tested the different colored flats with the EL-panel against each other as exposure and flat. All had then saturation and an extreme stretch added to reveal any color patterns. The result is very even exposures over the whole frame with no signs of circular artifacts. There is only perhaps a weak diagonal gradient with the Plexiglas (upper left), which could be due to directional outdoor light as I only rotated the Plexiglas plate and not the camera.

 

p3968059072.jpg p3967392657.jpg

 

 p3967392655-2.jpg p3967392658-2.jpg

 

(The last one is purple flat exposure with green flat so maximum color divergence. The different colors are due to technical issues with minimum steps in the adjustment and following extreme stretch step.)

 

So if I understand it right the color match problems initiating the thread do not seem to be present the same way, nor is DSS raw flat processing broken. It is interesting though that the real world tests with applying flat frames in RawTherapee and stacking TIFFS work better (although the processing can have other potential issues). I am not sure if anyone knows how the flat frames in RT are applied, whether per channel or only the same way as a manual vignetting correction with similar effect on all channels. It is also worth noting that the worst circular color artifacts appear with the brightest background.

 

In one of these last tests I accidentally got a flat with only front aperture on the 300mm PF mixed up with one where the lens also was stopped down to f/4.5 when applying them in DSS:

 

p3968111821.jpg

 

While circular artifact is expected due to the mismatch, it is interesting that it also causes color shifts.

 

So now I have contributed to confusing this thread even more. smile.gif


Edited by otoien, 29 August 2020 - 11:56 PM.


#37 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 29 August 2020 - 04:29 PM

Hi otoien,

 

That's an interesting set of results but I don't really know what is going on.  In fact I don't really know what is going on with the tests on my own camera!

 

By the way, which camera are you using - I don't think you said.

 

Mark


Edited by sharkmelley, 29 August 2020 - 04:29 PM.


#38 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 29 August 2020 - 05:35 PM

Yes, it is very confusing how it appears. The PANSTARR images are with my Nikon D500, the Pinwheel Galaxy is with the D7100. The flats shown in the first post and the flat cross application tests in the last post are with the D500. I would expect that if Nikon applies any compensating tweaking of raw data at edges, it would be more moderate in these DX bodies than on full frame.

 

I also have briefly tested but did not present one image capture session with a rather purple sky background on the Pleiades with my D5100 which at the time had partially hacked firmware, but only with the gray-greenish flat filter combination, and without the firmware hack reintroduced during flat capture (since the hack used for lights only addressed the hot pixel suppression algorithms, this should be only a minor flaw of the test). The capture was at ISO 400 while the ones with D500/D7100 was at ISO 1600. Also it had rather strong gradient in the sky, so it is a little hard to tell if there are any circular artifacts. (In all of these tests I made a point to only do global edits, not any local modifications to the captures.) 

 

I did a little more check on the RawTherapee documentation, and it appears that the flat field frame will compensate for both luminosity and color changes on linear raw data, so it is really not clear what the difference would be compared to the per channel application of flats in DSS:

 

To illustrate flat-field correction, a flat-field image has been applied unto itself. There is a noticeable light falloff asymmetry shown in the "before" image at the top, as well as a green color-cast. Flat-field correction removes both color and luminance non-uniformities and results in a perfectly uniform image. The histogram of the bottom "after" image indicates that the corrected image does not have any variation in the tones - exactly what one would expect from a uniform (flat) field. The same level of correction is applied to the "real" image when it is flat-field corrected.

https://rawpedia.raw...e corner areas.


Edited by otoien, 29 August 2020 - 05:46 PM.


#39 Kevin_A

Kevin_A

    Vanguard

  • *****
  • Posts: 2,185
  • Joined: 22 Aug 2018
  • Loc: Belmont, Ontario Canada

Posted 29 August 2020 - 06:49 PM

I just started experimenting with my flats as i originally did all with a led lightbox and the results were never great. Now i do strictly hazy grey sky shots with a t shirt and expose my histogram to the same 1/3rd from the left i tend to image at with both my z6 and z7. My results seem more uniform now that they are colour matched but not when i did LED or blue sky. I originally thought it was the exposure matching but nice to know there is more at play than just that.



#40 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 30 August 2020 - 01:15 AM

I did a little more check on the RawTherapee documentation, and it appears that the flat field frame will compensate for both luminosity and color changes on linear raw data, so it is really not clear what the difference would be compared to the per channel application of flats in DSS

There's no reason to suspect RawTherapee is doing anything different to DSS.  Both should be using the flat to calibrate the raw data by dividing one by the other (bias subtracted of course), pixel by pixel, before demosaicing.

 

Mark



#41 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 30 August 2020 - 02:20 AM

Yes, I also checked out DSS  (TIF 32-bit rational output without settings applied) and RT on a daylight scene captured with the 300PF and both kept the same normal color balance when flats of different colors were applied.



#42 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 30 August 2020 - 02:42 AM

In the end, we can summarise all this in a single sentence:

If a flat taken with one colour background does not correctly calibrate a flat taken with a different colour background then colour matched flats are likely to be useful.

 

Mark


  • Jerry Lodriguss, james7ca and otoien like this

#43 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 04 September 2020 - 03:13 AM

I found one color related difference in my processing the flats with DSS vs RT. The average flat file created from 8 multiple exposures has WB coefficients 1,1,1 according to ExifToolGUI. I confirmed that the "raw" data had the WB coefficients applied, presumably before averaging. This is logical from considering the normal use of multiple exposure mode. The camera could not know that I had the same WB in the yet to be done exposures, so it is likely how the averaging of the frames must be done.

 

I redid the same flat used with the PANSTARR RT flat field test, using an in-camera average flat also for DSS, but I still see the circular color gradients very similar to using single exposure flat with the same filter. So in this case the actual colors distribution of the "raw" data did not matter for the color artifact. 


Edited by otoien, 04 September 2020 - 03:20 AM.


#44 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 31 January 2021 - 06:36 AM

For the record of the thread, here is just a note that after the last post, I started consequently taking flats after every imaging session with the EL-panel filtered similar the blue-violet version to the lower right in post #34, and the problems with circular color gradients vanished. Strangely I also had one imaging session where I was in a hurry with immediate processing post capture and used the flat from a couple of nights before without a good result. I then immediately went out while the lens was still cooled down and took flats with the EL-panel without moving the focusing point and magically the fresh flats worked very well. So forward I will not make use of a library of flats and rather stick to record flats after each imaging session. Of course this also makes sense with respect to dust motes. An example from an imaging session from the Sadr region, stacked with DSS and stretched and post-processed in CNX2:

 

p4118623351.jpg

 

All of these good captures was in the fall when I basically used every opportunity before the snow arrived and with relatively favorable conditions with respect to light pollution for my red zone. I would typically have lights at about quarter histogram or so with color temperature very similar to the flat or leaning to the neutral with 1 minute exposures at ISO1600 and f/4.5. After the snow arrived covering ground and all the tree branches, quick tests at the same location have indicated >2 stops worse light pollution conditions, about middle of the histogram at ISO 800, which has kept me uninspired to do deep space imaging this winter. So it remains to test how the more adverse light pollution conditions will affect the results.


Edited by otoien, 31 January 2021 - 06:54 PM.


#45 otoien

otoien

    Mariner 2

  • -----
  • Posts: 248
  • Joined: 15 Jan 2019
  • Loc: Fairbanks, Alaska

Posted 09 February 2021 - 12:42 AM

Also for the record of this thread, on the background of the thread on concentric rings, https://www.cloudyni...ic-rings/page-8 , all exposures for the images/flats presented above were performed with lossless compressed NEF, so there should be none of the compression artifacts addressed in that thread.



#46 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 01 September 2021 - 05:11 PM

Re-opening this thread of mine, I've just done some testing of a Canon EOS R at ISO 1600 on the Tak Epsilon and found similar behaviour.

 

Here's the in-camera JPG of a night flat taken with a diffuser over the mouth of the Tak Epsilon:

 

CanonEOSR_night_flat.jpg

 

 

Here's the in-camera JPG of a sky flat taken at dusk, again with a diffuser:

 

CanonEOSR_dusk_flat.jpg

 

 

Here's the (highly stretched!) result of calibrating a stack of 16 raw night flats with a stack of 16 raw sky flats (both bias-subtracted of course):

 

CanonEOSR_calibrated_flat.jpg

 

Mark


Edited by sharkmelley, 01 September 2021 - 05:13 PM.


#47 sharkmelley

sharkmelley

    Cosmos

  • *****
  • topic starter
  • Posts: 8,247
  • Joined: 19 Feb 2013
  • Loc: UK

Posted 02 September 2021 - 04:26 AM

An additional experiment with the Canon EOS R shows that non-linearity is definitely part of the problem.  Here is the result of dividing two (bias-subtracted) ISO 1600 sky flats shot in quick succession at different exposure levels:

 

CanonEOSR_calibrated_flat2.jpg

 

The background colour in each exposure was identical and therefore any potential crosstalk effects would have been identical.  The result has been highly stretched in order to show the effect, so although it looks dramatic the actual non-linearity is less than 1%.  But 1% is enough to cause calibration difficulties for integration times of many hours.

 

Mark

 

 

 



#48 galacticinsomnia

galacticinsomnia

    Gemini

  • *****
  • Posts: 3,317
  • Joined: 14 Aug 2020
  • Loc: Pacific Northwest - Oregon

Posted 02 September 2021 - 06:58 PM

What about Camera Raw --> Mono Raw --> ColorRBG.  I lost all my data for the past year so I can't show my samples, but it was promising before abandoning calibrated frames for the most part.

Just something I was messing with and may try this again when using my camera lenses as they seem to be the worst offenders for Gradient issues in the optic train.

Clear Skies !!



#49 james7ca

james7ca

    Hubble

  • *****
  • Posts: 13,734
  • Joined: 21 May 2011
  • Loc: San Diego, CA

Posted 05 September 2021 - 05:48 AM

An additional experiment with the Canon EOS R shows that non-linearity is definitely part of the problem.  Here is the result of dividing two (bias-subtracted) ISO 1600 sky flats shot in quick succession at different exposure levels:

 

attachicon.gifCanonEOSR_calibrated_flat2.jpg

 

The background colour in each exposure was identical and therefore any potential crosstalk effects would have been identical.  The result has been highly stretched in order to show the effect, so although it looks dramatic the actual non-linearity is less than 1%.  But 1% is enough to cause calibration difficulties for integration times of many hours.

 

Mark

Where these done using a focal-plane shutter? If so, and depending upon the exposure times used this could have something to do with variations in the exposure across the frame caused by the mechanical shutter. It would be interesting to know whether the shutter in the Canon EOS R is a vertical or horizontal travel and at what speed it allows flash synchronization.



#50 johnpane

johnpane

    Ranger 4

  • *****
  • Posts: 351
  • Joined: 13 Dec 2014
  • Loc: Wexford, PA, USA

Posted 05 September 2021 - 06:50 AM

Where these done using a focal-plane shutter? If so, and depending upon the exposure times used this could have something to do with variations in the exposure across the frame caused by the mechanical shutter. It would be interesting to know whether the shutter in the Canon EOS R is a vertical or horizontal travel and at what speed it allows flash synchronization.

With a continuous light source the mechanical shutter will not cause variations in exposure across the frame.


  • Guest_11558 likes this


CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics