openCV library for Renesas RZ/A
Dependents: RZ_A2M_Mbed_samples
include/opencv2/shape/shape_transformer.hpp@0:0e0631af0305, 2021-01-29 (annotated)
- Committer:
- RyoheiHagimoto
- Date:
- Fri Jan 29 04:53:38 2021 +0000
- Revision:
- 0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RyoheiHagimoto | 0:0e0631af0305 | 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// |
RyoheiHagimoto | 0:0e0631af0305 | 2 | // |
RyoheiHagimoto | 0:0e0631af0305 | 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. |
RyoheiHagimoto | 0:0e0631af0305 | 4 | // |
RyoheiHagimoto | 0:0e0631af0305 | 5 | // By downloading, copying, installing or using the software you agree to this license. |
RyoheiHagimoto | 0:0e0631af0305 | 6 | // If you do not agree to this license, do not download, install, |
RyoheiHagimoto | 0:0e0631af0305 | 7 | // copy or use the software. |
RyoheiHagimoto | 0:0e0631af0305 | 8 | // |
RyoheiHagimoto | 0:0e0631af0305 | 9 | // |
RyoheiHagimoto | 0:0e0631af0305 | 10 | // License Agreement |
RyoheiHagimoto | 0:0e0631af0305 | 11 | // For Open Source Computer Vision Library |
RyoheiHagimoto | 0:0e0631af0305 | 12 | // |
RyoheiHagimoto | 0:0e0631af0305 | 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. |
RyoheiHagimoto | 0:0e0631af0305 | 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. |
RyoheiHagimoto | 0:0e0631af0305 | 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. |
RyoheiHagimoto | 0:0e0631af0305 | 16 | // Third party copyrights are property of their respective owners. |
RyoheiHagimoto | 0:0e0631af0305 | 17 | // |
RyoheiHagimoto | 0:0e0631af0305 | 18 | // Redistribution and use in source and binary forms, with or without modification, |
RyoheiHagimoto | 0:0e0631af0305 | 19 | // are permitted provided that the following conditions are met: |
RyoheiHagimoto | 0:0e0631af0305 | 20 | // |
RyoheiHagimoto | 0:0e0631af0305 | 21 | // * Redistribution's of source code must retain the above copyright notice, |
RyoheiHagimoto | 0:0e0631af0305 | 22 | // this list of conditions and the following disclaimer. |
RyoheiHagimoto | 0:0e0631af0305 | 23 | // |
RyoheiHagimoto | 0:0e0631af0305 | 24 | // * Redistribution's in binary form must reproduce the above copyright notice, |
RyoheiHagimoto | 0:0e0631af0305 | 25 | // this list of conditions and the following disclaimer in the documentation |
RyoheiHagimoto | 0:0e0631af0305 | 26 | // and/or other materials provided with the distribution. |
RyoheiHagimoto | 0:0e0631af0305 | 27 | // |
RyoheiHagimoto | 0:0e0631af0305 | 28 | // * The name of the copyright holders may not be used to endorse or promote products |
RyoheiHagimoto | 0:0e0631af0305 | 29 | // derived from this software without specific prior written permission. |
RyoheiHagimoto | 0:0e0631af0305 | 30 | // |
RyoheiHagimoto | 0:0e0631af0305 | 31 | // This software is provided by the copyright holders and contributors "as is" and |
RyoheiHagimoto | 0:0e0631af0305 | 32 | // any express or implied warranties, including, but not limited to, the implied |
RyoheiHagimoto | 0:0e0631af0305 | 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. |
RyoheiHagimoto | 0:0e0631af0305 | 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, |
RyoheiHagimoto | 0:0e0631af0305 | 35 | // indirect, incidental, special, exemplary, or consequential damages |
RyoheiHagimoto | 0:0e0631af0305 | 36 | // (including, but not limited to, procurement of substitute goods or services; |
RyoheiHagimoto | 0:0e0631af0305 | 37 | // loss of use, data, or profits; or business interruption) however caused |
RyoheiHagimoto | 0:0e0631af0305 | 38 | // and on any theory of liability, whether in contract, strict liability, |
RyoheiHagimoto | 0:0e0631af0305 | 39 | // or tort (including negligence or otherwise) arising in any way out of |
RyoheiHagimoto | 0:0e0631af0305 | 40 | // the use of this software, even if advised of the possibility of such damage. |
RyoheiHagimoto | 0:0e0631af0305 | 41 | // |
RyoheiHagimoto | 0:0e0631af0305 | 42 | //M*/ |
RyoheiHagimoto | 0:0e0631af0305 | 43 | |
RyoheiHagimoto | 0:0e0631af0305 | 44 | #ifndef OPENCV_SHAPE_SHAPE_TRANSFORM_HPP |
RyoheiHagimoto | 0:0e0631af0305 | 45 | #define OPENCV_SHAPE_SHAPE_TRANSFORM_HPP |
RyoheiHagimoto | 0:0e0631af0305 | 46 | #include <vector> |
RyoheiHagimoto | 0:0e0631af0305 | 47 | #include "opencv2/core.hpp" |
RyoheiHagimoto | 0:0e0631af0305 | 48 | #include "opencv2/imgproc.hpp" |
RyoheiHagimoto | 0:0e0631af0305 | 49 | |
RyoheiHagimoto | 0:0e0631af0305 | 50 | namespace cv |
RyoheiHagimoto | 0:0e0631af0305 | 51 | { |
RyoheiHagimoto | 0:0e0631af0305 | 52 | |
RyoheiHagimoto | 0:0e0631af0305 | 53 | //! @addtogroup shape |
RyoheiHagimoto | 0:0e0631af0305 | 54 | //! @{ |
RyoheiHagimoto | 0:0e0631af0305 | 55 | |
RyoheiHagimoto | 0:0e0631af0305 | 56 | /** @brief Abstract base class for shape transformation algorithms. |
RyoheiHagimoto | 0:0e0631af0305 | 57 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 58 | class CV_EXPORTS_W ShapeTransformer : public Algorithm |
RyoheiHagimoto | 0:0e0631af0305 | 59 | { |
RyoheiHagimoto | 0:0e0631af0305 | 60 | public: |
RyoheiHagimoto | 0:0e0631af0305 | 61 | /** @brief Estimate the transformation parameters of the current transformer algorithm, based on point matches. |
RyoheiHagimoto | 0:0e0631af0305 | 62 | |
RyoheiHagimoto | 0:0e0631af0305 | 63 | @param transformingShape Contour defining first shape. |
RyoheiHagimoto | 0:0e0631af0305 | 64 | @param targetShape Contour defining second shape (Target). |
RyoheiHagimoto | 0:0e0631af0305 | 65 | @param matches Standard vector of Matches between points. |
RyoheiHagimoto | 0:0e0631af0305 | 66 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 67 | CV_WRAP virtual void estimateTransformation(InputArray transformingShape, InputArray targetShape, |
RyoheiHagimoto | 0:0e0631af0305 | 68 | std::vector<DMatch>& matches) = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 69 | |
RyoheiHagimoto | 0:0e0631af0305 | 70 | /** @brief Apply a transformation, given a pre-estimated transformation parameters. |
RyoheiHagimoto | 0:0e0631af0305 | 71 | |
RyoheiHagimoto | 0:0e0631af0305 | 72 | @param input Contour (set of points) to apply the transformation. |
RyoheiHagimoto | 0:0e0631af0305 | 73 | @param output Output contour. |
RyoheiHagimoto | 0:0e0631af0305 | 74 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 75 | CV_WRAP virtual float applyTransformation(InputArray input, OutputArray output=noArray()) = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 76 | |
RyoheiHagimoto | 0:0e0631af0305 | 77 | /** @brief Apply a transformation, given a pre-estimated transformation parameters, to an Image. |
RyoheiHagimoto | 0:0e0631af0305 | 78 | |
RyoheiHagimoto | 0:0e0631af0305 | 79 | @param transformingImage Input image. |
RyoheiHagimoto | 0:0e0631af0305 | 80 | @param output Output image. |
RyoheiHagimoto | 0:0e0631af0305 | 81 | @param flags Image interpolation method. |
RyoheiHagimoto | 0:0e0631af0305 | 82 | @param borderMode border style. |
RyoheiHagimoto | 0:0e0631af0305 | 83 | @param borderValue border value. |
RyoheiHagimoto | 0:0e0631af0305 | 84 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 85 | CV_WRAP virtual void warpImage(InputArray transformingImage, OutputArray output, |
RyoheiHagimoto | 0:0e0631af0305 | 86 | int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, |
RyoheiHagimoto | 0:0e0631af0305 | 87 | const Scalar& borderValue=Scalar()) const = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 88 | }; |
RyoheiHagimoto | 0:0e0631af0305 | 89 | |
RyoheiHagimoto | 0:0e0631af0305 | 90 | /***********************************************************************************/ |
RyoheiHagimoto | 0:0e0631af0305 | 91 | /***********************************************************************************/ |
RyoheiHagimoto | 0:0e0631af0305 | 92 | |
RyoheiHagimoto | 0:0e0631af0305 | 93 | /** @brief Definition of the transformation |
RyoheiHagimoto | 0:0e0631af0305 | 94 | |
RyoheiHagimoto | 0:0e0631af0305 | 95 | ocupied in the paper "Principal Warps: Thin-Plate Splines and Decomposition of Deformations", by |
RyoheiHagimoto | 0:0e0631af0305 | 96 | F.L. Bookstein (PAMI 1989). : |
RyoheiHagimoto | 0:0e0631af0305 | 97 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 98 | class CV_EXPORTS_W ThinPlateSplineShapeTransformer : public ShapeTransformer |
RyoheiHagimoto | 0:0e0631af0305 | 99 | { |
RyoheiHagimoto | 0:0e0631af0305 | 100 | public: |
RyoheiHagimoto | 0:0e0631af0305 | 101 | /** @brief Set the regularization parameter for relaxing the exact interpolation requirements of the TPS |
RyoheiHagimoto | 0:0e0631af0305 | 102 | algorithm. |
RyoheiHagimoto | 0:0e0631af0305 | 103 | |
RyoheiHagimoto | 0:0e0631af0305 | 104 | @param beta value of the regularization parameter. |
RyoheiHagimoto | 0:0e0631af0305 | 105 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 106 | CV_WRAP virtual void setRegularizationParameter(double beta) = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 107 | CV_WRAP virtual double getRegularizationParameter() const = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 108 | }; |
RyoheiHagimoto | 0:0e0631af0305 | 109 | |
RyoheiHagimoto | 0:0e0631af0305 | 110 | /** Complete constructor */ |
RyoheiHagimoto | 0:0e0631af0305 | 111 | CV_EXPORTS_W Ptr<ThinPlateSplineShapeTransformer> |
RyoheiHagimoto | 0:0e0631af0305 | 112 | createThinPlateSplineShapeTransformer(double regularizationParameter=0); |
RyoheiHagimoto | 0:0e0631af0305 | 113 | |
RyoheiHagimoto | 0:0e0631af0305 | 114 | /***********************************************************************************/ |
RyoheiHagimoto | 0:0e0631af0305 | 115 | /***********************************************************************************/ |
RyoheiHagimoto | 0:0e0631af0305 | 116 | |
RyoheiHagimoto | 0:0e0631af0305 | 117 | /** @brief Wrapper class for the OpenCV Affine Transformation algorithm. : |
RyoheiHagimoto | 0:0e0631af0305 | 118 | */ |
RyoheiHagimoto | 0:0e0631af0305 | 119 | class CV_EXPORTS_W AffineTransformer : public ShapeTransformer |
RyoheiHagimoto | 0:0e0631af0305 | 120 | { |
RyoheiHagimoto | 0:0e0631af0305 | 121 | public: |
RyoheiHagimoto | 0:0e0631af0305 | 122 | CV_WRAP virtual void setFullAffine(bool fullAffine) = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 123 | CV_WRAP virtual bool getFullAffine() const = 0; |
RyoheiHagimoto | 0:0e0631af0305 | 124 | }; |
RyoheiHagimoto | 0:0e0631af0305 | 125 | |
RyoheiHagimoto | 0:0e0631af0305 | 126 | /** Complete constructor */ |
RyoheiHagimoto | 0:0e0631af0305 | 127 | CV_EXPORTS_W Ptr<AffineTransformer> createAffineTransformer(bool fullAffine); |
RyoheiHagimoto | 0:0e0631af0305 | 128 | |
RyoheiHagimoto | 0:0e0631af0305 | 129 | //! @} |
RyoheiHagimoto | 0:0e0631af0305 | 130 | |
RyoheiHagimoto | 0:0e0631af0305 | 131 | } // cv |
RyoheiHagimoto | 0:0e0631af0305 | 132 | #endif |