Author Topic: Image Solver/Focal length calculation  (Read 4196 times)

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Image Solver/Focal length calculation
« on: 2015 September 02 17:42:20 »
Using a sample image I get this report from Image Solver:

========================================================
Referentiation Matrix (Gnomonic projection = Matrix * Coords[x,y]):
           +0.000190468       -5.53464e-008           -0.319207
          +8.53177e-008         +0.00019046           -0.241338
                     +0                  +0                  +1
Projection origin.. [1676.282351 1266.380252]pix -> [RA:+22 09 12.72 Dec:-09 51 54.40]
Resolution ........ 0.686 arcsec/pix
Rotation .......... 179.980 deg
Focal ............. 1624.44 mm
Pixel size ........ 5.40 um
Field of view ..... 38' 18.4" x 28' 56.1"
Image center ...... RA: 22 09 12.710  Dec: -09 51 54.66
Image bounds:
   top-left ....... RA: 22 07 54.907  Dec: -10 06 22.64
   top-right ...... RA: 22 10 30.546  Dec: -10 06 21.61
   bottom-left .... RA: 22 07 54.987  Dec: -09 37 26.60
   bottom-right ... RA: 22 10 30.398  Dec: -09 37 25.57
========================================================

The formula for calculating FL from an image is:

FL (mm) = 206265 * pixel size (mm/pixel) / plate scale (arcsec/pixel)

I carefully measured a few star distances on the plate and found a plate scale of 0.6865 arcsec/pixel which is in agreement with Image Solver.

The camera is a SBIG STF-8300M with pixel size of 5.4 u (0.0054 m)
substituting into the above equation yields:
FL = 206265 * 0.0054 / 0.6865 = 1622.48 mm

Image Solver shows 1624.44 mm

Why the difference between the two numbers?  Both are using the same Pixel size and plate scale.
Curvature of the plate?

Offline NGC7789

  • PixInsight Old Hand
  • ****
  • Posts: 391
Re: Image Solver/Focal length calculation
« Reply #1 on: 2015 September 02 18:06:52 »
Isn't this just a rounding issue.

If you reverse calculate the image scale from the reported focal length you get

206265 * .0054 / 1624.44 = 0.685671

0.685671 is being rounded to .686

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #2 on: 2015 September 02 19:37:06 »
Possibly, I am looking to confirm the method used for calculating the focal length in Image Solver so I can reproduce it at this end.

The reason for the accuracy is for determining the spacing between mirrors in a RC telescope.  If one of the mirrors is moved too far in or out then the focal length will change and hence the plate scale.  I am thinking that Image Solver could be used to determine that the mirrors are out of alignment (separation in this case) by measuring the plate scale exactly and calculating the focal length.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Solver/Focal length calculation
« Reply #3 on: 2015 September 03 01:36:43 »
The relevant functions are these:

Code: [Select]
   this.ResolutionFromFocal = function( focal )
   {
      return (focal > 0) ? this.xpixsz/focal*0.18/Math.PI : 0;
   };

   this.FocalFromResolution = function( resolution )
   {
      return (resolution > 0) ? this.xpixsz/resolution*0.18/Math.PI : 0;
   };

where
  • focal in mm
  • pixel size in um
  • resolution in deg/pixel

In the formulas by CraigNZ the constant 206265 is truncated. A more precise value would be 206264.80624709635515647335733078.

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #4 on: 2015 September 03 12:31:02 »
Andres,

Thank you .. that is exactly what I was looking for.

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #5 on: 2015 September 03 19:44:44 »
The order of calculations on the formula above threw me a bit, it would be better to write it as:
  return (resolution > 0) ? (this.xpixsz/resolution) * (0.18/Math.PI) : 0;

Doing this and using the values from Image solver I get:

  fl = (5.4 * 3600 / 0.6865) * (0.18/pi) = 1622.48 mm

which is the same as using the original formula

or, using the values from Image Solver:
  fl = (5.4 * 3600 / 0.686) * (0.18/pi) = 1623.66 mm

So this shows the equation used by PI is equivalent to the one I used, giving the same results.

The discrepancy between the results above and what is displayed in Image Solver is probably due to one of the numbers:

5.4 - this is the pixel size, I am assuming PI is getting this from the FITS header:
  XPIXSZ = 5.4

3600 is the conversion of arcsec to degrees so that should be okay.

0.686(5) - this is the number reported by IS and was verified by measuring two stars on the plate, so it is good.

0.18 is 180 degrees / 1000 um/mm  the 180 is used in converting from radians to degrees, and the 1000 is converting um to mm

pi is a mathematical constant

Assuming the 5.4 is the same value used in both methods then it is likely the plate scale is different.  Working the equation in reverse results in a plate size of:

resolution = (5.4 / 1624.44) * 3600 * (0.18 / pi) = 0.68567

This shows the error is likely due to (a) rounding when displaying the plate scale, and (b) me not being able to measure the plate scale manually to this precision.

Using the value 0.68567 shows a focal length of

  fl = (5.4 * 3600 / 0.68567) * (0.18/pi) = 1624.44 mm

So a very small change in plate scale results in a few mm variance in the focal length.  Could we therefore have the precision of the resolution number in the Image Solver report extended from 3 decimal places to 5 decimal places?

Current: Resolution ..... 0.686 arc sec / pix

Proposed: Resolution ..... 0.68567 arc sec / pix


Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Solver/Focal length calculation
« Reply #6 on: 2015 September 04 01:15:53 »
Hi Craig,

the results of ImageSolver have not enough precision for showing more than 3 decimal places. 3 decimal places are more than enough and are chosen trying to avoid the False precision fallacy. The actual precision achieved by ImageSolver is difficult to calculate since it depends on many factors: actual resolution, noise in the image, number of stars, accuracy of the catalog, etc. Under normal conditions the precision should be about 1/100 of a pixel but it could vary a lot.

In any case, if you need the maximum accuracy in the calculation of the focal length, your limiting factor now is not ImageSolver. I am sure that the size of the pixels of your camera is not a nice round number like 5.4. You should try to find a better value.

Finally if you really want to know the calculated resolution without any rounding, you can calculate it from the FITS header. Using the process FITSHeader find the keys CD1_1, CD1_2, CD2_1 and CD2_2.
Code: [Select]
resx = sqrt( CD1_1 * CD1_1 + CD1_2 * CD1_2)
resy = sqrt( CD2_1 * CD2_1 + CD2_2 * CD2_2)

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #7 on: 2015 September 04 01:45:29 »
Hi Andrés,
I agree about the limits of precision, in which case we should not display the resolution as 1624.44 which implies 6 digits df precision.  With only three digits we would need to round this to 1620.


Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #8 on: 2015 September 04 02:21:46 »
Assuming the data sheet for the KAF 8300 sensor is accurate then we are limited to 4 significant digits for the pixel size because the size of the active sensor area is given as 17.33 mm.  Dividing the active sensor size by the number of active pixels we get o.oo539987973 rounded to 4 significant digits is 5.400 microns per pixel.

If this is the limiting factor in the equation then we can specify the resolution as 1624 mm.

The plate scale would be o.6857 arc seconds per pixel.

We would need to know if the plate scale has a precision of 4 significant digits by examine how it is derived.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Solver/Focal length calculation
« Reply #9 on: 2015 September 04 02:23:05 »
Hi Craig, two decimal places are necessary when solving short focal length images. I could show a different number of decimal places for different ranges of values, but I think it is not worth the effort. Other option would be to use an exponential format (i.e. 1.234e3) and always show 4 significant figures, but it is much less readable.

Offline CraigNZ

  • PixInsight Enthusiast
  • **
  • Posts: 94
Re: Image Solver/Focal length calculation
« Reply #10 on: 2015 September 04 02:58:41 »
Agreed, we don't need to create extra work when not necessary.  What we now know is how the resolution is calculated and the precision.  Thanks heaps for providing that.

PI is well designed and forms a base for serious image processing, especially in photometry and astrometry.  I have moved from Mirametrics software to PI for my work and hoping to contribute to its growth.


Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Image Solver/Focal length calculation
« Reply #11 on: 2015 September 04 03:17:32 »
In the basic case (when the distortion correction is not active) ImageSolver uses a translation matrix for converting between pixel coordinates and projection plane coordinates. Please read these papers:
http://www.aanda.org/articles/aa/pdf/2002/45/aah3859.pdf
http://www.aanda.org/articles/aa/pdf/2002/45/aah3860.pdf
The coefficients of the transformation matrix are calculated using a multiple linear regression for minimizing the error. The matrix is then stored in multiple FITS keywords as specified in the WCS papers.
The resolution is computed using the formulas that I wrote in a previous message.
« Last Edit: 2015 September 04 03:26:03 by Andres.Pozo »