By Simon Dawes
   Equipment  
   Images  
   Location  
   ATM  
   Techniques  
   My Software  
   spare  
   Links  
   About Me  
   Ramblings  
 



sub-menu
 
 
Sun Safety
 
 
Contrast
 
 
Artificial Flats
 
 
4
 
 
5
 
 
6
 

Techniques

 

Artificial Flat Fields

We have all done it, gone to process our images only to find out that the flat field we had doesn't seem to work effectively, be it poor technique, file corruption, a change in optical set-up or simply forgotten/ not had time to make those flats. Well all is not lost, in some circumstances you can make an artificial flat field, these are not a replacement for good flats but a technique for recovering otherwise unusable images.

Here I will take you through the steps for creating an artificial flat field that will remove dust donuts, sky gradients etc. To show how powerful a technique it is I am going to use a truly dreadful image as an example.

 

Lets introduce the offending Image of M56, this image has had it's dark frame subtracted.

Dust donuts and a gradient (top left to bottom right) are clearly visible

 

Incidentally this image was take during a very hot night before I had finished building the CCD, so the peltier cooler wasn't working and the chip had loads of dust on it (which I wasn't concerned about for the CCD test) but it does make good example of a poor image.

 

 
Click on the image for a larger version

Theory

Consider the 10 by 10 image opposite, this represents a portion of the image with a dust donut and a star.

Ideally our artificial flat field will continue to have the dust donut but not the star.

Step up the Median Rank Operator.

This operator replaces each existing pixel value with a new pixel value, the new value is determined by taking the median of the values around the pixel being calculated.

Crucially by sampling an area at least double the size of the star to determine each pixel value we can remove small details (i.e. details with a high spatial resolution)

                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       


Here I have added the original pixel values to the image and have noted that the star has a radius of 0.5 pixels, so by choosing a radius of 1.5 for the rank median operator we should be able to eliminate all detail smaller than 0.5 pixels in radius.

 

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

 

Example 1

So lets consider what the new value of the pixel in bold will be if we use a radius of 1 with the rank median operator.

We have median(0,0,0,0,0,0,0,0,2) = 0 i.e. it hasn't changed.

 

 

 

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

 

Example 2

Now lets consider a pixel in the dust donut.

We have median(0,2,2,2,3,3,3,3,3) = 3 i.e. it hasn't changed.

 

 

 

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

 

Example 3

Now lets consider the pixel value for the star.

We have median(0,0,0,0,15,0,0,0,0) = 0 i.e. the star has been removed and been replaced with the sky background value.

 

 

 

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

 

Here I have calculated the value of every pixel using the rank median operator
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
2
2
3
3
2
0
0
0
0
2
3
3
3
3
3
3
2
0
0
0
0
0
2
3
3
3
3
2
0
0
0
0
0
0
0
2
2
2
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

 

We now simply subtract the artificial flat field from the original
0
0
0
0
0
0
0
0
0
0
0
0