Astrofriend's homepage
Share: Twitter Reddit Facebook Gmail Gmail Email
Search Astrofriend's homepage:

Valid CSS!

All pages shall now have been validated

Info Cookies (Kakor) / GDPR


Advertisement /

Twitter @AstrofriendLars

Follow Astrofriend

Project News

Advertisement / Annons:

Make a synthetic flat calibration image


  1. Introduction and calculation of parameters for synthetic flat image
  2. How to use background light to setup Flatfield function

I take no responsibility or liability for what are written here, you use the information at your own risk!

1, Introduction:

This is totally new and I still doing my first test of the Flatfield plugin and the Excel sheet.

I have some old astrophotos taken with cameras and telescopes that I no longer have left. The old flat frame images I have are or of bad quality or I don't have any at all and I can't make new anymore.

I also have problem with the flat images I take today. There are always new dust and drying stains from earlier cleaning that don't match the flat image. There are also old dust and markings on flat image that have been cleaned away from the sensor, see below how it appear on the image. I can of course always take new flats and make new master flats, but it's very time consuming. There are also internal reflections in the telescope that get caught on the flat image that make problem when increasing the contrast in the images.

Dust blobs on astro photography

The light grey blobs are from the flat calibration when it try to correct for dust that's not on the sensor anymore. The dark gray blobs are from new dust on the sensor which is not on the flat frame. Of course will a master flat created by math not handle the dust blobs, but I think it's better to handle them separate. One drawback is that a synthetic flat image doesn't compensate that different pixels has small variations in the sensitivity relative each other. But I already deal with fixed pattern in the back ground with dithering technique, that will also reduce this problem as well.

These problem are what I try to solve with synthetic flat images. I will do it with AstroImageJ, but there was one problem for me. To do this I need to develop the plugin with JAVA, and that something I don't have any deep knowledge of. But now I got a new friend who knows how to do these JAVA plugin and he is interested in astronomy too, I learn a lot from him.

Find a polynomial that simulate vignetting, a flat frame:

Excel sheet, calculating the polynomial parameters

I have prepared this by setup an Excel sheet that calculate the parameters for a polynomial that simulate a rotation symmetric vignetting. The polynomial is of sixth degree.

  • General Polynomial Y = a*x0 + b*x1 + c*x2 + d*x3 + e*x4 + f*x5 + g*x6

Because it's rotation symmetric the b*x1, d*x3 and e*x5 are not used.

The function that calculate a flat frame use the radius which is: r = rot ( x2 + y2 )

  • Flat frame Polynomial: Level(r) = a*r0 + c*r2 + e*r4 + g*r6

To get something to start with it is good to have an old flat frame even if it is of bad quality. In an example on next page I will show how to use the background to get some values to use when setting up the polynomial. The camera data with the size in pixels of the sensor has to be put in the Excel sheet. The X and Y position of the optical center has to be find. It's needed some levels along the radius-axis, from the corner to the optical center. The X and Y-positions to use for these test points are calculated in the Excel sheet above (ImageJ X, ImageJ Y, columns colored green).

All fields is market red are were you have to put in some data. The blue fields are were you get data to the Flatfield-plugin that make the synthetic master flat.

Find optical center:

Old bad flat image

I use AstroImageJ and open one not so good masterflat. First try to find the optical center, it's not very difficult. Open an old masterflat image or an image with heavy background light. It open as a grey scale, here I have changed the Lockup color table to get it colored, se below how.

AstroImageJ: Lockup table

Change the lockup table in AIJ to someone that increase the contrast and let you see the center better. Adjust the contrast of the image with the scrollbars at bottom of the image, zoom in.

Old flat image, optical center at max signal

Move the cursor to the center where the level (Value, top right) is strongest, move the cursor around the center to get some average level. Take the coordinates of ImageJ X, ImageJ Y (above left) and put it in the Excel sheet at camera data and 'optical center real'. You also get the size of the image at top left, in this case 2238x1477, put in this figures in the Excel sheet.

Now there shall be some pre calculated positions where to place the curser, the green values in the Excel sheet.

Find the levels along X-axis:

Old flat image, X-axis values

Move the cursor until ImageJ X and ImageJ Y correspond to the pre calculated table 'X and Y-columns' colored green in the Excel sheet. You only take the values on the left side, the values on the right side will just be a mirror because this vignetting simulation we calculate is rotation symmetric. It follows the line from upper left corner to where it cross the optical center. Take the Value at the pre calculated ImageJ X and ImageJ Y coordinates and put it in the Excel sheet.

Input data at red fields

Use the figures from top left of the image where you have the size of the sensor and put it in the Excel sheet, top left red fields.

Optical center:
Take the ImageJ X, ImageJ Y position for optical center and put it in the Excel sheet at 'Optical center real'.

Values along the diagonal:
Take X-column Value and put it in the Excel sheet at 'Y Level', I will change the name to Signal level later.

Calculate the parameters:

Output parameters for polynomial

The constants for the polynomial will immediately be calculated. The upper row of blue values. The second red row is used to set these parameters manually if you want to fine adjust them. Both the calculated and your fitted curve will be drawn in the Excel sheet so you get an overview how it looks. Choose either the blue or red parameters and write them in the Flatfield function in AstroImageJ. You can now download the Flatfield plugin at bottom of this page and install in AstroImageJ.

The problem for me with this master flat and why I don't use it directly, it is that I only have the aperture set to f/4.5, not f/5.6 or f/6.3. By testing with variation of the parameters I can find the correct curve fit for the other aperatures.

Line graph of master flat, calculated and manually

A flat image are normally normalized to have the value = 1 at center.

Setup 'Generate synthetic flat':

AstroImageJ: Open plugin make synthetic flat frame

Take one set of the polynomial parameters and put them in the plugin Flatfield to generate a synthetic flat. The Flatfield plugin is now ready for download.

AstroImageJ: Created synthetic flat frame

The new synthetic master flat. You can use it for all colors. Save it somewhere in your directories for master flats.

This is just the beginning, it will come more later !

Excel sheet that calculate the parameters:

You can download the Excel sheet here:

You download and use this file at your own risk !

History, version
Change the text information.
Added one more degree.
Origo moved to optical center.
Some bug fix.
First Beta version.

Function Flatfield for AstroImageJ:

You can download the function here:

You download and use this file at your own risk !

History, version
First Beta version.

Instructions how to use AstroImageJ and install plugins: Tutorial AstroImageJ.

Go Back to content

Go Back
To page II

Advertisement / Annons: