Author Topic: ManualImageSolver  (Read 11595 times)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
ManualImageSolver
« on: 2013 May 26 11:15:41 »
This is the announcement of ManualImageSolver, a new script for solving the coordinates of astronomical images. The objective of ManualImageSolver is to solve the coordinates of images that ImageSolver can not solve. The script ImageSolver is able to find the coordinates of an astronomical image without more user interaction than a few starting parameters (approximate image center and resolution). ImageSolver works well with clean images of medium/high resolution. However images with too much noise or a wide field are much harder to solve and sometimes ImageSolver can not do it.

ManualImageSolver is able to find the coordinates of astronomical images that can not be solved by ImageSolver. This script uses a group of control points defined by the user that match points in the image that is being solved (Target image) with the corresponding point in an image with known coordinates (Reference image). Given enough control points the script can determine the coordinates of the image with quite good precision. This script can support images with strong distortions.
The full documentation of the script can be found in this PDF: https://dl.dropboxusercontent.com/u/71653208/FotosForum/ManualImageSolver.pdf
The contents of the PDF will be available inside PixInsight directly from the script when/if distributed as an "official" part of PixInsight. If anybody is interested I can provide the source of the documentation in .pidoc.

The attached 7zip file contains a distribution of my scripts where ManualImageSolver can be found. It has also an updated version of ImageSolver with two new options: "Distortion template" and "Only apply optimization". Please read the documentation of ManualImageSolver to know what these options are for.

I have tried this script with a set of images that I took a few years ago in a trip to Chile. They were taken using a DSLR and a 17-70 Sigma lens at 17mm. I could never align them neither get a coordinates solution. However, using ManualImageSolver I have been able to get a very good quality solution.

The next image shows the corners of the residuals image. It can be seen that even at the  corners the residuals are very low: The green crosses are centered on the stars and the residuals arrows (red lines) are so short that they seem to be points.


The next image shows the distortion of the images:


This image is an annotated version of one of the images where it can be seen the quality of the solution:

(Click on the image for a full size version)

I think that ManualImageSolver is very important because allows to solve wide field images and it opens the door to other scripts: I have nearly finished  an script called AlignByCoordinates that uses the coordinates solution for aligning images. This script can correct the geometric distortion of the images, align images with strong distortions and generate mosaics fixing the geometry of the tiles.


Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: ManualImageSolver
« Reply #1 on: 2013 May 26 13:28:22 »
Amazing Tools!  8)
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Philippe B.

  • PixInsight Old Hand
  • ****
  • Posts: 399
    • CIEL AUSTRAL
Re: ManualImageSolver
« Reply #2 on: 2013 May 27 00:06:49 »
Thank you, Andres, for all your great work for Pixinsight !


ruediger

  • Guest
Re: ManualImageSolver
« Reply #3 on: 2013 May 27 02:58:40 »
I have nearly finished  an script called AlignByCoordinates that uses the coordinates solution for aligning images. This script can correct the geometric distortion of the images, align images with strong distortions and generate mosaics fixing the geometry of the tiles.
Sounds very interesting! Will the mosaic projection be limited to orthogonal projection? (this might be only of interest for very large fields).
Once I don't have to use a virtualized Linux (for scamp/swarp) anymore and can do everything I need in PixInsight, I'd be very happy :-)

Rüdiger

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: ManualImageSolver
« Reply #4 on: 2013 May 27 03:25:33 »
I have nearly finished  an script called AlignByCoordinates that uses the coordinates solution for aligning images. This script can correct the geometric distortion of the images, align images with strong distortions and generate mosaics fixing the geometry of the tiles.
Sounds very interesting! Will the mosaic projection be limited to orthogonal projection? (this might be only of interest for very large fields).
Once I don't have to use a virtualized Linux (for scamp/swarp) anymore and can do everything I need in PixInsight, I'd be very happy :-)

Rüdiger
The first version will only use the Gnomonic projection. This projection can be used for moderately wide fields, perhaps up to 90-120º, although with strong distortions at the borders. The attached image has a field of about 120x90 degrees.

I plan to add more projections for future versions. I am open to suggestions about what would the most useful.

This version is nearly finished. I have to finish some tests and write the documentation. As a preview you can see the quality of the alignment of 12 images of 17mm in this YouTube video. It shows sequentially the four corners and the center of the images.
http://www.youtube.com/watch?v=ARiKCITz1lI


Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: ManualImageSolver
« Reply #5 on: 2013 May 27 03:40:48 »
Gnomic is ok for moderate fields. In addition to that, I would give Mollweide (for full sky images) a high priority.
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: ManualImageSolver
« Reply #6 on: 2013 May 27 10:22:03 »
Superb, Andres, this will be absolutely useful for my work in helping people on Reddit learn to use PI. I've received plenty of difficult images that ImageSolver cannot get right out of the box, and this is a great secondary solution.

Thanks!


Edit: Working on an image, starting with Catalog Star Generator. On my mac (Retina MBP), the Image Scale box is smooshed down:

« Last Edit: 2013 May 27 10:34:47 by Josh Lake »

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: ManualImageSolver
« Reply #7 on: 2013 June 08 09:54:09 »
CatalogStarGenerator: I get an "Invalid Image Resolution Error" for the Setting:
- Mizar as Center
- focal length 12mm
- Pixel size 11.2 um.
See screenshot.
Georg

Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: ManualImageSolver
« Reply #8 on: 2013 June 08 11:44:33 »
CatalogStarGenerator: I get an "Invalid Image Resolution Error" for the Setting:
- Mizar as Center
- focal length 12mm
- Pixel size 11.2 um.
See screenshot.
Georg
The resolution of the image is limited to 120"/px. This limitation is too strict. I will increase the limit to a higher value in a future version.

Meanwhile, you can use this parameters:
  • Mizar as Center
  • focal length 12mm
  • Pixel size 5.6 um.
  • width=3908
  • height=2602

You can also edit the scrip and change the limit of resolution. Change in the function "CatStarGeneratorDialog.Validate" the line:
Code: [Select]
if (engine.resolution == null || engine.resolution <= 0 || engine.resolution > 120 / 3600)
Substitute the value 120 by 300.


Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: ManualImageSolver
« Reply #9 on: 2013 June 08 12:10:01 »
Geog,

these are a few suggestions about CatalogStarGenerator:
  • It is better that you use the catalog BrightStars instead NameStars
  • The value Saturation Magnitude defines which stars are saturated in the image. For wide field images the value 10 is way too high. You should use 2 or even less.
  • Since neither NamedStars nor BrightStars have stars with magnitude greater that 7, you should use a value for the background magnitude of 8-10.
  • The best results are achieved using a Moffat distribution with a beta between 1.5 and 2.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: ManualImageSolver
« Reply #10 on: 2013 June 09 03:23:08 »
Andres,

thanks for the hints!

Before reading your hints, I helped myself with using a smaller reference image. The attached screenshot shows the reference image (right) and the manually solved image to the left. The solution is not high quality - I just wanted to understand the general procedure. As you can see, AnnotateImage only annotated half of the image. Probably, ManualSolver just transforms the solution from the reference image, without adapting it to the different size of the target image. Or maybe it is some other bug in AnnotateImage?

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: ManualImageSolver
« Reply #11 on: 2013 June 09 04:00:10 »
Andres,

thanks for the hints!

Before reading your hints, I helped myself with using a smaller reference image. The attached screenshot shows the reference image (right) and the manually solved image to the left. The solution is not high quality - I just wanted to understand the general procedure. As you can see, AnnotateImage only annotated half of the image.

How many control points did you set? Which degree did you used for the polynomials?
If you use polynomial of degree >1 you have to cover the whole target image with control points, especially the borders and corners of the image.

Quote
Probably, ManualSolver just transforms the solution from the reference image, without adapting it to the different size of the target image.
The algorithm of ManualImageSolver is this:
  • The script reads the control points from the DynamicAlignment icon. For each point we get the pixel coordinates of the same star in both images.
  • Using the solution of the reference image it converts for each control point the pixel coordinates to AR/Dec coordinates.
  • Now for each control point we have the celestial coordinates and the pixel coordinates in the target image.
  • The script computes an approximation to the celestial coordinates of the center of the image and creates a Gnomonic projection with origin at the center of the image.
  • Then it projects the celestial coordinates of the control points using the Gnomonic projection to a flat space (we can call it G).
  • Using a multiple linear regression it calculates the polynomials that transform the pixel coordinates of the control points to G.
  • The projection and the polynomials define a solution. Since it used an approximation of the celestial coordinates of the center of the image, the solution is not optimal yet.
  • The solution is refined calculating a new approximation to the center of the image using the new solution. The steps 5-7 are repeated until it converges.

After ManualImageSolver, refining the image with image solver is usually a good idea. Many images that could not be solved with ImageSolver, can be optimized with it after solving them with ManualImageSolver. You have to check the "Only optimize" option. This is explained in the PDF.

Quote
Or maybe it is some other bug in AnnotateImage?
This could be happening. When using solutions of high degree >4, it is quite difficult to know when a point is inside or outside of the image.
This is less problematic when the images have been optimized with ImageSolver.

It would be very helpful if you would send me the solved image.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: ManualImageSolver
« Reply #12 on: 2013 June 09 04:28:11 »
Hi Andres,

I am not complaining about the quality of the solution - I just wanted to do a quick experiment with your module, basically to identify the two satellites visible on the image (ISS and probably Spot 5, image taken at June 6th, 11pm Berlin time from Munich).

The image has been uploaded to https://skydrive.live.com/redir?resid=C56E60845CFA6790!234&authkey=!AKlE7UdYJDj0qto (manual_annotated.fit, not_yet_annotated.fit).

Georg
« Last Edit: 2013 June 09 04:45:17 by georg.viehoever »
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)