precomp.hpp 4.48 KB
Newer Older
wester committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                          License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's 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.
//
//   * The name of the copyright holders may not 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 Intel Corporation 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.
//
//M*/
wester committed
42 43
#ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__
wester committed
44

wester committed
45 46 47 48
#include "opencv2/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/core/utility.hpp"
wester committed
49

wester committed
50
#include "opencv2/core/private.hpp"
wester committed
51

wester committed
52
#include "opencv2/core/ocl.hpp"
wester committed
53

wester committed
54 55 56 57 58
#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/calib3d/calib3d_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif
wester committed
59 60


wester committed
61
namespace cv
wester committed
62 63
{

wester committed
64
int RANSACUpdateNumIters( double p, double ep, int modelPoints, int maxIters );
wester committed
65

wester committed
66
class CV_EXPORTS LMSolver : public Algorithm
wester committed
67 68
{
public:
wester committed
69
    class CV_EXPORTS Callback
wester committed
70
    {
wester committed
71 72 73 74
    public:
        virtual ~Callback() {}
        virtual bool compute(InputArray param, OutputArray err, OutputArray J) const = 0;
    };
wester committed
75

wester committed
76 77
    virtual void setCallback(const Ptr<LMSolver::Callback>& cb) = 0;
    virtual int run(InputOutputArray _param0) const = 0;
wester committed
78 79
};

wester committed
80
CV_EXPORTS Ptr<LMSolver> createLMSolver(const Ptr<LMSolver::Callback>& cb, int maxIters);
wester committed
81

wester committed
82
class CV_EXPORTS PointSetRegistrator : public Algorithm
wester committed
83 84
{
public:
wester committed
85
    class CV_EXPORTS Callback
wester committed
86
    {
wester committed
87 88 89 90 91 92 93 94 95
    public:
        virtual ~Callback() {}
        virtual int runKernel(InputArray m1, InputArray m2, OutputArray model) const = 0;
        virtual void computeError(InputArray m1, InputArray m2, InputArray model, OutputArray err) const = 0;
        virtual bool checkSubset(InputArray, InputArray, int) const { return true; }
    };

    virtual void setCallback(const Ptr<PointSetRegistrator::Callback>& cb) = 0;
    virtual bool run(InputArray m1, InputArray m2, OutputArray model, OutputArray mask) const = 0;
wester committed
96 97
};

wester committed
98 99 100 101 102 103
CV_EXPORTS Ptr<PointSetRegistrator> createRANSACPointSetRegistrator(const Ptr<PointSetRegistrator::Callback>& cb,
                                                                    int modelPoints, double threshold,
                                                                    double confidence=0.99, int maxIters=1000 );

CV_EXPORTS Ptr<PointSetRegistrator> createLMeDSPointSetRegistrator(const Ptr<PointSetRegistrator::Callback>& cb,
                                                                   int modelPoints, double confidence=0.99, int maxIters=1000 );
wester committed
104

wester committed
105
template<typename T> inline int compressElems( T* ptr, const uchar* mask, int mstep, int count )
wester committed
106
{
wester committed
107 108 109 110 111 112 113 114 115
    int i, j;
    for( i = j = 0; i < count; i++ )
        if( mask[i*mstep] )
        {
            if( i > j )
                ptr[j] = ptr[i];
            j++;
        }
    return j;
wester committed
116
}
wester committed
117 118 119 120

}

#endif