This is the sample implementation and benchmark dataset of the binary image registration algorithm described in the following paper:
Csaba Domokos and Zoltan Kato. Parametric Estimation of Affine Deformations of Planar Shapes. Pattern Recognition, 43(3):569--578, March 2010.
The main code has been written by Zsolt Katona in Java. The code is released under the GNU General Public License.
The program uses PHCpack: a general-purpose solver for polynomial systems written by Jan Verschelde. A shared library has been made from PHCpack to access the solver from Java through a native method call.
The benchmark dataset has been created by Csaba Domokos. It contains 56 different template images of size approx. 1000 X 1000 and 49282 observations generated synthetically by random affine transformations. Please cite the above publication whenever you use the dataset.
The application runs only under Microsoft Windows.
To run the application:
- Change to the
AffineRegistrationOfBinaryImages.jar in Windows Explorer.
Hint: specifying the maximum heap size of the Java Virtual Machine is strongly recommended when working with large images. To specify the heap size, start the application from the command line by typing:
java -jar -Xmx512m AffineRegistrationOfBinaryImages.jar
The heap size is specified after the
-Xmx parameter without whitespaces.
To build the application:
JAVA_HOME environment variable properly. Do not use quotes when setting
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_11
bin directory must also be added to
- Change to
AffineRegistrationOfBinaryImages folder, and type in the command line:
Binaries are made into the
Note: source can be opened in Netbeans IDE as a project.
Only binary images can be opened (1 bit-per-pixel). Some test images are provided under the
images subdirectory. The program GUI should be intuitive. Main steps:
- Open template image.
- Open observation image or create one synthetically from the template.
- Press Registrate button.
- Save registration results.
The red lines in the image windows show the coordinate axes, the origin is in the upper left corner. The y-axis is vertical, with values increasing from top to bottom. The x-axis is horizontal with values increasing from left to right.
When displaying images, 'Location of image' tag tells us where the upper-left corner of the transformed image's bounding box is mapped. When saving results, this information is saved into the info file at the 'Location of images X' and 'Location of images Y' tags.
The choosen interpolation method affects the creation of a synthetic observation from the template as well as the creation of the registered image.
If you start the application from the command-line, some options are available:
java -jar AffineRegistrationOfBinaryImages.jar options
A short description of output files
- (no parameter)
Starts the graphical user interface.
Registration of the template image to the observation image without user interaction. By default, the output files will be:
templatePath observationPath infoFilePath matlabFilePath
observationCCSPath registeredCCSPath xorPath magentaGreenPath
Registration of the template image to the observation image without user interaction. The last six parameters specify the output filenames. If you do not wish to save one of them use a hyphen (-) instead of that filename.
This option is for batch processing only.
A text file containing all information about the registration.
The transformation matrix is saved to a
.mat file that can be loaded in MATLAB. The name of the MATLAB variable is
The observation is displayed in the common coordinate system. First the common bounding box of the aligned images is computed, then the observation image is displayed in this area.
The registered template is displayed in the common coordinate system. First the common bounding box of the aligned images is computed, then the template image is transormed into this area by the recovered transformation.
The result of a bitwise XOR operator on the observation and the registered template.
The registered template is assigned to both red and blue channels while the observation is assigned to the green channel.
This is a synthetic binary image dataset for testing affine registration
methods. All images are in PNG format. There are 56 different template images around size 1000 x 1000. The observations were generated synthetically by applying randomly choosen affine transformations composed by
The images are binary and the 0 and 1 represents the background and foreground, respectively!
- 0, 10, ..., 350 degree of rotations;
- 0, 0.4, ..., 1.2 shearings;
- 0.5, 0.7, ..., 1.9 scalings;
- -20, 0, 20 translations along both axes.
contains the template images in PNG file format. There are 19 linedawing
and 37 filled images.
Naming convention: image????.png (image0001.png, image0002.png, ..., image0056.png)
contains all observations for each template. There are 49282 images.
Naming convention: observation????_????.png, where the first four digits
are the template number, and last four digits count
the number of the observation for the given template.
Each observation has an associated data file with the same name and extension .dat.
Fields of a datafile
||filename of the corresponding template image
||height of the template image
||the number of the foreground pixels on the template
||filename of the observation (Note that: the
observation has the same name as the
corresponding datafile with extension .png
||height of the observations image
||the number of the foreground pixels on the observation
|the applied transformation matrix (row by row)
||the determinant of the applied
||ObservationPixel / TemplatePixel