/* ===================================== === LIMEREG - Lightweight Image Registration === ======================================== Forked from the project FIMREG, which was written for a distributed calculation on the PCIe card DSPC-8681 of Advantech. LIMEREG does not use DSPs and can be run on an ordinary PC without special hardware. FIMREG was originally developed by by Roelof Berg, Berg Solutions (rberg@berg-solutions.de) with support from Lars Koenig, Fraunhofer MEVIS (lars.koenig@mevis.fraunhofer.de) and Jan Ruehaak, Fraunhofer MEVIS (jan.ruehaak@mevis.fraunhofer.de). THIS IS A LIMITED RESEARCH PROTOTYPE. Documentation: www.berg-solutions.de/limereg.html ------------------------------------------------------------------------------ Copyright (c) 2014, Roelof Berg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the owner nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------*/ #ifndef _LIMEREG_H_ #define _LIMEREG_H_ /*! @page liblimereg 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. Sourcecode: http://embeddedsoftwarearchitecture.com/limereg.html @section usage Usage Information Link with -mlimereg and #include . API documentation see: man limereg.h @section copyright Copyright 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. @section examples Examples In the source distribution at http://embeddedsoftwarearchitecture.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. */ /*! \file limereg.h \brief 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://embeddedsoftwarearchitecture.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://embeddedsoftwarearchitecture.com/limereg.html */ #ifdef __cplusplus extern "C" { #endif enum Limereg_RetCode { //General return codes LIMEREG_RET_SUCCESS=0, //!< No error LIMEREG_RET_INTERNAL_ERROR=1, //!< Unexpected internal error LIMEREG_RET_RCV_NULLPTR=2, //!< An unexpected nullpointer was passed as an argument LIMEREG_RET_INVALID_PYRAMID_TYPE=3, //!< The enum value of PyramidImage is invalid in the current context //Parameter parsing LIMEREG_RET_IMAGE_TOO_SMALL=100, //!< xDimension or yDimension smaller than alloweg (e.g. 0) LIMEREG_RET_MAX_ROT_INVALID=101, //!< The rotation in registrResultLimits is invalid (too big or small) LIMEREG_RET_MAX_TRANS_INVALID=102, //!< The shift in registrResultLimits is invalid (too big) LIMEREG_RET_STARTPARAM_INVALID=103, //!< The content of startParameters in Limereg_RegisterImage() is invalid. Check if the content is plausible and within the bounds of registrResultLimits. //Registration processing LIMEREG_RET_ABORT_MAXITER_EXCEEDED=200, //!< The registration algorithm took more iterations than allowed by maxIterations and was aborted //Temporary codes LIMEREG_RET_STENCIL_NOT_IMPL_YET=9997, //!< Currently stencil images are unsupported and the pointer named stencilImage has to be set to 0 /*deprecated: 9998*/ LIMEREG_RET_IMAGES_MUST_HAVE_SAME_SIZE=9999 //!< Currently the images to be registered must both have the same size (this limitation will be removed soon) }; /*! Flags to control the registration algorithm */ enum Limereg_Flags { Limereg_Trafo_Rigid=0 //!< Rigid transformation: Supports horizontal, vertical shift and rotation. The size of the image area remains the same. //, Limereg_Trafo_Affine=2 ... coming soon ... }; /*! \brief 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_Image { enum PixelType //!< The supported pixel interpretation types { Limereg_Grayscale_8=0 //!< Only luminance, no color, 8 bit per pixel } pixelType; //!< How to interpret pixelBuffer enum PyramidImage //!< Normal or pyramid image { Limereg_NotPyramidized=0, //!< pixelBuffer contains a plain image. This is the usual case, Limereg will generate a multilevel pyramid internally.) Limereg_Pyramidized //!< pixelBuffer contains a pyramid image, e.g. generated by Limereg_CreatePyramid(). } pyramidImage; unsigned char* pixelBuffer; //!< Byte array with luminance data (1 byte per pixel). unsigned int imageWidth; //!< Horizontal image dimension unsigned int imageHeight; //!< Vertical image dimension }; /*! \brief 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_TrafoParams { double xShift; //