Version Française

C Polar Align

1. License

This software is under GPL, so it can be used redistributed and modified freely, while respecting the terms of the license, in particular to retain the copyrights and that the sources (including additions and or modifications) remain accessible.

The distribution includes CImg (, Ephemeris ( and GetPot ( The star detection algorithm is derived from Part of the files are under "Copyright (C) 2015 Carsten Schmitt". The star catalog is extracted from: VizieR Astronomical Server

2. Introduction

This software is an aid tool for the alignment of an equatorial mount. From 2 images (it use JPEG) with a 90 degree rotation along the AD axis , the software computes the center of rotation between the 2 images then draws on the images the position of the stars of the field. After each adjustment, the software displays the new image.

There is no astrometry, only a geometric algorithm to compute the center of rotation. The focal length and the size of the pixels must be accurately specified.

To use it, you need a sensor and a lens that can provide fairly detailed photos over a fairly wide field around the pole.

A 24x36 digital camera with a 50mm to 300mm focal lens or an APS-C with between 30mm and 200mm will  be fine. A compact will also do the trick as long as the lens is bright (at minimum zoom) and that we can pose a few seconds. In all cases, it is essential that it is possible to control the camera from the PC and in practice, that it is supported by gphoto2 with "capture" and "download" features.

3. Installation

3.1 Linux

The software is written under Linux. Tested with ubuntu (16, 18 and 20), gentoo free BSD and also with an old debian on an ARM board.

It depend on:

    - libjpeg to compile,

    - gphoto2 to execute.

Ubuntu compilation and installation process:

                    - get libjpeg:

ubuntu%  sudo apt-get install libjpeg-dev

    - get gphoto2

ubuntu% sudo apt-get install gphoto2

    - get basic X11 libraries:

ubuntu% sudo apt-get install libx11-dev

    - Get the sources which includes "CImg" for images processing, "ephemeris" and 'getpot" to manage options in files or command line:

% git clone

% cd polar_align/polar_align

% cd ephemeris ; make ; cd ..

% cd getpot-c++; make; cd ..

% cd c_polar_align

% make

% make install

If c++ is an old one, try the options commented in the current Makefile.

3.2 portability

3.2.1 Windows

CImg based software compile under Windows. So, it should be possible to port it to windows. The point is to get a convenient tool to control the camera.

3.2.2 Android

It seems likely that CImg can be used with Android, since there are tools to control camera but configuration should be integrated.

4. Configure the software

Options allow to adapt the behavior of the software according to the context, to the camera model, or to users preferences.

These options are added at the command line or stored in files.

  1. "polar align" first tries to read the "" file in the user's "$HOME" directory and sets the options
  2. "polar_align" then reads the file given on the command line after the "-file" or "-config" option and can modify the parameters
  3. "polar_align" finally takes into account the options provided on the command line which are therefore the final values.

options list:

5. Communication with the camera.

c_polar_align need

  1. control the camera to take a picture,
  2. download it,
  3. if the image is not in JPEG, convert it to JPEG and give it the correct name,
  4. read the image in JPEG format.
To do this, it executes a system command which can be an executable or a script with its options. This procedure is tested under linux and with gphoto2.

The default command is 'gphoto2  --force-overwrite --capture-image-and-download --filename PA0.jpg' . Defaults for files name are PA0.jpg, PA1.jpg ...
the "polar align" "-getphoto" option allow you to replace this command. The provided command should include all options, and if using gphoto2 end with a " ", so the software just appends the filename at the end.

For example:

        The camera should be set in "RAW+JPEG" mode. The speed is from the camera (not BULB).

        The camera should be set in "RAW+JPEG" mode. The speed is set to "BULB" on the camera so the speed is controlled by gphoto2. Here it is set to 5 seconds.

        allows "polar_align" to run a script which takes as argument the name of the photo to be let in the current directory.

6. Utilisation

Turn the mount between 30 and 90 degrees from horizontal:

Get the first image:

Reset the mount as horizontal as possible and get a second image.

Use "+", "-" from the numeric pad to compensate for errors in the horizontality of the mount (or time or longitude)
so that
each star can be set to its nominal position by the same translation .

use the alt/az settings of the mount to perform this translation

  Click to zoom at 100%: