Renesas / opencv-lib

Dependents:   RZ_A2M_Mbed_samples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers shape_transformer.hpp Source File

shape_transformer.hpp

00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                          License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
00016 // Third party copyrights are property of their respective owners.
00017 //
00018 // Redistribution and use in source and binary forms, with or without modification,
00019 // are permitted provided that the following conditions are met:
00020 //
00021 //   * Redistribution's of source code must retain the above copyright notice,
00022 //     this list of conditions and the following disclaimer.
00023 //
00024 //   * Redistribution's in binary form must reproduce the above copyright notice,
00025 //     this list of conditions and the following disclaimer in the documentation
00026 //     and/or other materials provided with the distribution.
00027 //
00028 //   * The name of the copyright holders may not be used to endorse or promote products
00029 //     derived from this software without specific prior written permission.
00030 //
00031 // This software is provided by the copyright holders and contributors "as is" and
00032 // any express or implied warranties, including, but not limited to, the implied
00033 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00034 // In no event shall the Intel Corporation or contributors be liable for any direct,
00035 // indirect, incidental, special, exemplary, or consequential damages
00036 // (including, but not limited to, procurement of substitute goods or services;
00037 // loss of use, data, or profits; or business interruption) however caused
00038 // and on any theory of liability, whether in contract, strict liability,
00039 // or tort (including negligence or otherwise) arising in any way out of
00040 // the use of this software, even if advised of the possibility of such damage.
00041 //
00042 //M*/
00043 
00044 #ifndef OPENCV_SHAPE_SHAPE_TRANSFORM_HPP
00045 #define OPENCV_SHAPE_SHAPE_TRANSFORM_HPP
00046 #include <vector>
00047 #include "opencv2/core.hpp"
00048 #include "opencv2/imgproc.hpp"
00049 
00050 namespace cv
00051 {
00052 
00053 //! @addtogroup shape
00054 //! @{
00055 
00056 /** @brief Abstract base class for shape transformation algorithms.
00057  */
00058 class CV_EXPORTS_W ShapeTransformer : public Algorithm
00059 {
00060 public:
00061     /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches.
00062 
00063     @param transformingShape Contour defining first shape.
00064     @param targetShape Contour defining second shape (Target).
00065     @param matches Standard vector of Matches between points.
00066      */
00067     CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape,
00068                                                  std::vector<DMatch>& matches) = 0;
00069 
00070     /** @brief Apply a transformation, given a pre-estimated transformation parameters.
00071 
00072     @param input Contour (set of points) to apply the transformation.
00073     @param output Output contour.
00074      */
00075     CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0;
00076 
00077     /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image.
00078 
00079     @param transformingImage Input image.
00080     @param output Output image.
00081     @param flags Image interpolation method.
00082     @param borderMode border style.
00083     @param borderValue border value.
00084      */
00085     CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output,
00086                                    int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT,
00087                                    const Scalar & borderValue=Scalar ()) const = 0;
00088 };
00089 
00090 /***********************************************************************************/
00091 /***********************************************************************************/
00092 
00093 /** @brief Definition of the transformation
00094 
00095 ocupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by
00096 F.L. Bookstein (PAMI 1989). :
00097  */
00098 class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer
00099 {
00100 public:
00101     /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS
00102     algorithm.
00103 
00104     @param beta value of the regularization parameter.
00105      */
00106     CV_WRAP virtual void setRegularizationParameter(double beta) = 0;
00107     CV_WRAP virtual double getRegularizationParameter() const = 0;
00108 };
00109 
00110 /** Complete constructor */
00111 CV_EXPORTS_W Ptr<ThinPlateSplineShapeTransformer>
00112     createThinPlateSplineShapeTransformer(double regularizationParameter=0);
00113 
00114 /***********************************************************************************/
00115 /***********************************************************************************/
00116 
00117 /** @brief Wrapper class for the OpenCV Affine Transformation algorithm. :
00118  */
00119 class CV_EXPORTS_W AffineTransformer : public ShapeTransformer
00120 {
00121 public:
00122     CV_WRAP virtual void setFullAffine(bool fullAffine) = 0;
00123     CV_WRAP virtual bool getFullAffine() const = 0;
00124 };
00125 
00126 /** Complete constructor */
00127 CV_EXPORTS_W Ptr<AffineTransformer> createAffineTransformer(bool fullAffine);
00128 
00129 //! @}
00130 
00131 } // cv
00132 #endif