limereg.h(3) Library for lightweight image registration.

SYNOPSIS


Data Structures


struct Limereg_Image
Pointer to pixeldata and image dimensions Image buffer with data pointer and image dimensions. The buffer consists of one byte per pixel of luminance data (greyscale).
struct Limereg_TrafoParams
Parameters for a rigid transformation Parameters for a rigid transformation. That is horizontal and vertical shift and a rotation angle. The image will retain it's dimensions, it will not be sheared, only shift and rotation are allowed.
struct Limereg_AdvancedRegControl
Advanced parameters for controlling the image registration This parameters allow the control of advanced parameters. Each parameter can be set to 0 for an autodetect or default behavior. Also a nullpointer can be passed instead of this struct if for all advanced parameters the autodetect/default value shall be used.
struct Limereg_TrafoLimits
Result limits for a rigid transformation Maximum allowed result (shift/rotation) for the rigid transformation result of the image registration. The algorithm will stay in this boundary, it will not abort.

Enumerations


enum Limereg_RetCode { LIMEREG_RET_SUCCESS =0, LIMEREG_RET_INTERNAL_ERROR =1, LIMEREG_RET_RCV_NULLPTR =2, LIMEREG_RET_INVALID_PYRAMID_TYPE =3, LIMEREG_RET_IMAGE_TOO_SMALL =100, LIMEREG_RET_MAX_ROT_INVALID =101, LIMEREG_RET_MAX_TRANS_INVALID =102, LIMEREG_RET_STARTPARAM_INVALID =103, LIMEREG_RET_ABORT_MAXITER_EXCEEDED =200, LIMEREG_RET_STENCIL_NOT_IMPL_YET =9997, LIMEREG_RET_IMAGES_MUST_HAVE_SAME_SIZE =9999 }

enum Limereg_Flags { Limereg_Trafo_Rigid =0 }

Functions


const char * Limereg_GetVersion ()
Get library version. Returns the package version of liblimereg in use by the current application.
enum Limereg_RetCode Limereg_RegisterImage (const struct Limereg_Image *referenceImage, const struct Limereg_Image *templateImage, const struct Limereg_TrafoLimits *registrResultLimits, const unsigned int flags, const struct Limereg_AdvancedRegControl *advancedCtrl, struct Limereg_TrafoParams *registrResult, double *distanceMeasure, unsigned int *iterationAmount, unsigned int *iterationsPerLevel)
Register two images. Find out the horizontal/vertical shift and the rotation for the best possible overlay of both images.
enum Limereg_RetCode Limereg_CreatePyramid (const struct Limereg_Image *sourceImage, const struct Limereg_TrafoLimits *registrResultLimits, const unsigned int flags, const struct Limereg_AdvancedRegControl *advancedCtrl, struct Limereg_Image *pyramidImage)
Create multilevel pyramid (FOR ADVANCED USE ONLY. IF NOT USED, THE PYRAMID IS CREATED AUTOMATICALLY). Create a multilevel pyramid. For a usual image registration this function should be AVOIDED. In usual cases Limereg_RegisterImage() creates the multilevel pyramid internally, automatically. The images of each pyramid level will be bigger than the (scaled) source image, because margins will be added that allow Dirichlet boundary conditions to be used without jumps / pipeline hazards.
enum Limereg_RetCode Limereg_DeletePyramid (const struct Limereg_Image *pyramidImage)
Delete multilevel pyramid created by Limereg_CreatePyramid() (FOR ADVANCED USE ONLY. IF NOT USED, THE PYRAMID IS CREATED AUTOMATICALLY). Delete a multilevel pyramid that was created by Limereg_CreatePyramid(). For a usual image registration this function should be AVOIDED. In usual cases Limereg_RegisterImage() creates and deletes the multilevel pyramid internally, automatically.
enum Limereg_RetCode Limereg_TransformImage (const struct Limereg_Image *sourceImage, const struct Limereg_TrafoParams *trafoParams, struct Limereg_Image *transformedImage)
Rigid image transformation. Apply shift and rotation obtained by Limereg_RegisterImage to an image.
enum Limereg_RetCode Limereg_CalculateDiffImage (const struct Limereg_Image *referenceImage, const struct Limereg_Image *templateImage, struct Limereg_Image *differenceImage)
Generate difference image. Calculate the difference image between reference and the template image (sum of squared differences).

Detailed Description

Library for lightweight image registration.

Software development library, that performs a 2D, rigid image registration on two greyscale images and outputs either the transformation parameters or the registered image.

Examples:
In the source distribution at http://embedded-software-architecture.com/limereg.html the following folders contain examples:
tests: C written test automation that can be used as example code.
exe: C++ written commandline utility using liblimereg.

Copyright 2014, Roelof Berg, Licensed under the 3-clause BSD license at http://berg-solutions.de/limereg-license.html. Credit goes to Lars Koenig and Jan Ruehaak from Fraunhofer MEVIS in Germany.

Sourcecode:
http://embedded-software-architecture.com/limereg.html

Enumeration Type Documentation

enum Limereg_Flags

Flags to control the registration algorithm

Enumerator

Limereg_Trafo_Rigid
Rigid transformation: Supports horizontal, vertical shift and rotation. The size of the image area remains the same.

enum Limereg_RetCode

Enumerator

LIMEREG_RET_SUCCESS
No error.
LIMEREG_RET_INTERNAL_ERROR
Unexpected internal error.
LIMEREG_RET_RCV_NULLPTR
An unexpected nullpointer was passed as an argument.
LIMEREG_RET_INVALID_PYRAMID_TYPE
The enum value of PyramidImage is invalid in the current context.
LIMEREG_RET_IMAGE_TOO_SMALL
xDimension or yDimension smaller than alloweg (e.g. 0)
LIMEREG_RET_MAX_ROT_INVALID
The rotation in registrResultLimits is invalid (too big or small)
LIMEREG_RET_MAX_TRANS_INVALID
The shift in registrResultLimits is invalid (too big)
LIMEREG_RET_STARTPARAM_INVALID
The content of startParameters in Limereg_RegisterImage() is invalid. Check if the content is plausible and within the bounds of registrResultLimits.
LIMEREG_RET_ABORT_MAXITER_EXCEEDED
The registration algorithm took more iterations than allowed by maxIterations and was aborted.
LIMEREG_RET_STENCIL_NOT_IMPL_YET
Currently stencil images are unsupported and the pointer named stencilImage has to be set to 0.
LIMEREG_RET_IMAGES_MUST_HAVE_SAME_SIZE
Currently the images to be registered must both have the same size (this limitation will be removed soon)

Function Documentation

enum Limereg_RetCode Limereg_CalculateDiffImage (const struct Limereg_Image * referenceImage, const struct Limereg_Image * templateImage, struct Limereg_Image * differenceImage)

Generate difference image. Calculate the difference image between reference and the template image (sum of squared differences). The images are treated as byte array where one byte matches the luminance (grey-value) of one pixel.

Parameters:

referenceImage Reference image (image to be matched against)
templateImage Template image (image to be shifted/rotated until it matches to the reference image)
differenceImage Result: Output image will be written to here. The passed width and height fields have to match the buffer space (width*heigth bytes).

Returns:

return code

enum Limereg_RetCode Limereg_CreatePyramid (const struct Limereg_Image * sourceImage, const struct Limereg_TrafoLimits * registrResultLimits, const unsigned int flags, const struct Limereg_AdvancedRegControl * advancedCtrl, struct Limereg_Image * pyramidImage)

Create multilevel pyramid (FOR ADVANCED USE ONLY. IF NOT USED, THE PYRAMID IS CREATED AUTOMATICALLY). Create a multilevel pyramid. For a usual image registration this function should be AVOIDED. In usual cases Limereg_RegisterImage() creates the multilevel pyramid internally, automatically. The images of each pyramid level will be bigger than the (scaled) source image, because margins will be added that allow Dirichlet boundary conditions to be used without jumps / pipeline hazards. The member Limereg_Image.PyramidImage of the output buffer will be set to Pyramidized and the data pointer will point to the pyramid image data. The memory for the image data will be created on the heap by this function, use Limereg_DeletePyramid() to free this memory again lateron.

Important: The parameters registrResultLimits, flags and pyramidLevelCount have to be equal to the later calls to Limereg_RegisterImage() and have to stay equal for every call to Limereg_RegisterImage().

Parameters:

sourceImage Image data for the finest level of the multilevel pyramid.
registrResultLimits Maximum shift and rotation allowed/expected. The algorithm will stay inside this boundaries.
flags Variations in the mathematical approach (0=default)
advancedCtrl Advanced parameters for fine tuning the algorithm (NULLPOINTER = Autodetect best settings, maxIterations, stopSensitivity and startParameters are ignored here)
pyramidImage Buffer of subsequent pyramid images, starting with the finest, proceeding up to the coarsest level

Returns:

return code

enum Limereg_RetCode Limereg_DeletePyramid (const struct Limereg_Image * pyramidImage)

Delete multilevel pyramid created by Limereg_CreatePyramid() (FOR ADVANCED USE ONLY. IF NOT USED, THE PYRAMID IS CREATED AUTOMATICALLY). Delete a multilevel pyramid that was created by Limereg_CreatePyramid(). For a usual image registration this function should be AVOIDED. In usual cases Limereg_RegisterImage() creates and deletes the multilevel pyramid internally, automatically. The member Limereg_Image.PyramidImage of the output buffer is expected to have the value Pyramidized.

Returns:

return code

const char* Limereg_GetVersion ()

Get library version. Returns the package version of liblimereg in use by the current application.

Returns:

Pointer to a null terminated char array containing the version string.

enum Limereg_RetCode Limereg_RegisterImage (const struct Limereg_Image * referenceImage, const struct Limereg_Image * templateImage, const struct Limereg_TrafoLimits * registrResultLimits, const unsigned int flags, const struct Limereg_AdvancedRegControl * advancedCtrl, struct Limereg_TrafoParams * registrResult, double * distanceMeasure, unsigned int * iterationAmount, unsigned int * iterationsPerLevel)

Register two images. Find out the horizontal/vertical shift and the rotation for the best possible overlay of both images. The images are treated as byte array where one byte matches the luminance (grey-value) of one pixel.

Parameters:

referenceImage Reference image R (image to be matched against)
templateImage Template image T (image to be shifted/rotated until it matches to the reference image)
registrResultLimits Maximum shift and rotation allowed/expected. The algorithm will stay inside this boundaries.
flags Variations in the mathematical approach (0=default)
advancedCtrl Advanced parameters for fine tuning the algorithm (NULLPOINTER = Autodetect best settings)
registrResult Registration result: Shift and rotation for the best detected image alignment (NULL = ignored)
distanceMeasure For informational purposes. The distance measure of the final result (the lower, the better the images are aligned, not comparable between images of different size) (NULL = ignored)
iterationAmount Total amount of algorithm iterations passed (NULL = ignored)
iterationsPerLevel NULL = ignored / or a pointer to an array with levelCount (see above) elements that will be filled with the iterations needed on each level (beginning with the coarsest one)

Returns:

return code

enum Limereg_RetCode Limereg_TransformImage (const struct Limereg_Image * sourceImage, const struct Limereg_TrafoParams * trafoParams, struct Limereg_Image * transformedImage)

Rigid image transformation. Apply shift and rotation obtained by Limereg_RegisterImage to an image. The images are treated as byte array where one byte matches the luminance (grey-value) of one pixel.

Parameters:

sourceImage Source image to be shifted/rotated
trafoParams Shift and rotation to be applied
transformedImage Result: Output image will be written to here (same image dimensions as the sourceImage).

Returns:

return code

Author

Generated automatically by Doxygen for liblimereg-1.4.0 from the source code.