mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Finalize core headers reorganization
This commit is contained in:
parent
c979de1eed
commit
940eedfb27
@ -29,6 +29,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
struct str_greater
|
||||||
|
{
|
||||||
|
bool operator() (const cv::String& a, const cv::String& b) { return a > b; }
|
||||||
|
};
|
||||||
|
|
||||||
class CameraWrapperConnector
|
class CameraWrapperConnector
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -177,7 +182,7 @@ CameraActivity::ErrorCode CameraWrapperConnector::connectToLib()
|
|||||||
|
|
||||||
std::vector<cv::String> listLibs;
|
std::vector<cv::String> listLibs;
|
||||||
fillListWrapperLibs(folderPath, listLibs);
|
fillListWrapperLibs(folderPath, listLibs);
|
||||||
std::sort(listLibs.begin(), listLibs.end(), std::greater<cv::String>());
|
std::sort(listLibs.begin(), listLibs.end(), str_greater());
|
||||||
|
|
||||||
void * libHandle=0;
|
void * libHandle=0;
|
||||||
cv::String cur_path;
|
cv::String cur_path;
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
#include "test_precomp.hpp"
|
#include "test_precomp.hpp"
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
@ -48,6 +48,8 @@
|
|||||||
#include "opencv2/features2d.hpp"
|
#include "opencv2/features2d.hpp"
|
||||||
#include "opencv2/objdetect.hpp"
|
#include "opencv2/objdetect.hpp"
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/****************************************************************************************\
|
/****************************************************************************************\
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
#include "retinafilter.hpp"
|
#include "retinafilter.hpp"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
@ -57,18 +57,6 @@
|
|||||||
#include "opencv2/core/mat.hpp"
|
#include "opencv2/core/mat.hpp"
|
||||||
#include "opencv2/core/persistence.hpp"
|
#include "opencv2/core/persistence.hpp"
|
||||||
|
|
||||||
#ifndef SKIP_INCLUDES
|
|
||||||
#include <limits.h>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <complex>
|
|
||||||
#include <map>
|
|
||||||
#include <new>
|
|
||||||
#include <vector>
|
|
||||||
#include <sstream>
|
|
||||||
#endif // SKIP_INCLUDES
|
|
||||||
|
|
||||||
/*! \namespace cv
|
/*! \namespace cv
|
||||||
Namespace where all the C++ OpenCV functionality resides
|
Namespace where all the C++ OpenCV functionality resides
|
||||||
*/
|
*/
|
||||||
@ -951,6 +939,42 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////// Formatted output of cv::Mat ///////////////////////////
|
||||||
|
|
||||||
|
class CV_EXPORTS Formatted
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual const char* next() = 0;
|
||||||
|
virtual void reset() = 0;
|
||||||
|
virtual ~Formatted();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CV_EXPORTS Formatter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum { FMT_MATLAB = 0,
|
||||||
|
FMT_CSV = 1,
|
||||||
|
FMT_PYTHON = 2,
|
||||||
|
FMT_NUMPY = 3,
|
||||||
|
FMT_C = 4,
|
||||||
|
FMT_DEFAULT = FMT_MATLAB
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual ~Formatter();
|
||||||
|
|
||||||
|
virtual Ptr<Formatted> format(const Mat& mtx) const = 0;
|
||||||
|
|
||||||
|
virtual void set32fPrecision(int p = 8) = 0;
|
||||||
|
virtual void set64fPrecision(int p = 16) = 0;
|
||||||
|
virtual void setMultiline(bool ml = true) = 0;
|
||||||
|
|
||||||
|
static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////// Algorithm ////////////////////////////////////
|
//////////////////////////////////////// Algorithm ////////////////////////////////////
|
||||||
|
|
||||||
class CV_EXPORTS Algorithm;
|
class CV_EXPORTS Algorithm;
|
||||||
|
@ -1,44 +1,45 @@
|
|||||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||||
//
|
//
|
||||||
// By downloading, copying, installing or using the software you agree to this license.
|
// 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,
|
// If you do not agree to this license, do not download, install,
|
||||||
// copy or use the software.
|
// copy or use the software.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// License Agreement
|
// License Agreement
|
||||||
// For Open Source Computer Vision Library
|
// For Open Source Computer Vision Library
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2008-2013, Willow Garage Inc., all rights reserved.
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Copyright (C) 2013, OpenCV Foundation, 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 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 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
|
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||||
// and / or other materials provided with the distribution.
|
// 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.
|
// * 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
|
// This software is provided by the copyright holders and contributors "as is" and
|
||||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
// any express or implied warranties, including, but not limited to, the implied
|
||||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||||
// indirect, incidental, special, exemplary, or consequential damages
|
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||||
// (including, but not limited to, procurement of substitute goods or services;
|
// indirect, incidental, special, exemplary, or consequential damages
|
||||||
// loss of use, data, or profits; or business interruption) however caused
|
// (including, but not limited to, procurement of substitute goods or services;
|
||||||
// and on any theory of liability, whether in contract, strict liability,
|
// loss of use, data, or profits; or business interruption) however caused
|
||||||
// or tort (including negligence or otherwise) arising in any way out of
|
// and on any theory of liability, whether in contract, strict liability,
|
||||||
// the use of this software, even if advised of the possibility of such damage.
|
// 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*/
|
//
|
||||||
|
//M*/
|
||||||
|
|
||||||
#ifndef __OPENCV_CORE_AFFINE3_HPP__
|
#ifndef __OPENCV_CORE_AFFINE3_HPP__
|
||||||
#define __OPENCV_CORE_AFFINE3_HPP__
|
#define __OPENCV_CORE_AFFINE3_HPP__
|
||||||
@ -119,24 +120,36 @@ namespace cv
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T> Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
|
template<typename T> static
|
||||||
template<typename T, typename V> V operator*(const Affine3<T>& affine, const V& vector);
|
Affine3<T> operator*(const Affine3<T>& affine1, const Affine3<T>& affine2);
|
||||||
|
|
||||||
|
template<typename T, typename V> static
|
||||||
|
V operator*(const Affine3<T>& affine, const V& vector);
|
||||||
|
|
||||||
typedef Affine3<float> Affine3f;
|
typedef Affine3<float> Affine3f;
|
||||||
typedef Affine3<double> Affine3d;
|
typedef Affine3<double> Affine3d;
|
||||||
|
|
||||||
cv::Vec3f operator*(const cv::Affine3f& affine, const cv::Vec3f& vector);
|
static cv::Vec3f operator*(const cv::Affine3f& affine, const cv::Vec3f& vector);
|
||||||
cv::Vec3d operator*(const cv::Affine3d& affine, const cv::Vec3d& vector);
|
static cv::Vec3d operator*(const cv::Affine3d& affine, const cv::Vec3d& vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Implementaiton
|
/// Implementaiton
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3() : matrix(Mat4::eye()) {}
|
template<typename T> inline
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const Mat4& affine) : matrix(affine) {}
|
cv::Affine3<T>::Affine3()
|
||||||
|
: matrix(Mat4::eye())
|
||||||
|
{}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const Mat4& affine)
|
||||||
|
: matrix(affine)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t)
|
||||||
{
|
{
|
||||||
rotation(R);
|
rotation(R);
|
||||||
translation(t);
|
translation(t);
|
||||||
@ -144,7 +157,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t
|
|||||||
matrix.val[15] = 1;
|
matrix.val[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const Vec3& rvec, const Vec3& t)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const Vec3& rvec, const Vec3& t)
|
||||||
{
|
{
|
||||||
rotation(rvec);
|
rotation(rvec);
|
||||||
translation(t);
|
translation(t);
|
||||||
@ -152,7 +166,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const Vec3& rvec, const Vec3
|
|||||||
matrix.val[15] = 1;
|
matrix.val[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const cv::Mat& data, const Vec3& t)
|
||||||
{
|
{
|
||||||
CV_Assert(data.type() == cv::DataType<T>::type);
|
CV_Assert(data.type() == cv::DataType<T>::type);
|
||||||
|
|
||||||
@ -168,7 +183,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const cv::Mat& data, const V
|
|||||||
matrix.val[15] = 1;
|
matrix.val[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(float_type alpha, float_type beta, float_type gamma, const Vec3& t)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(float_type alpha, float_type beta, float_type gamma, const Vec3& t)
|
||||||
{
|
{
|
||||||
rotation(alpha, beta, gamma);
|
rotation(alpha, beta, gamma);
|
||||||
translation(t);
|
translation(t);
|
||||||
@ -176,14 +192,20 @@ template<typename T> inline cv::Affine3<T>::Affine3(float_type alpha, float_type
|
|||||||
matrix.val[15] = 1;
|
matrix.val[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::Affine3<T>::Identity()
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::Affine3<T>::Identity()
|
||||||
{
|
{
|
||||||
return Affine3<T>(cv::Affine3<T>::Mat4::eye());
|
return Affine3<T>(cv::Affine3<T>::Mat4::eye());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline void cv::Affine3<T>::rotation(const Mat3& R) { linear(R); }
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::rotation(const Mat3& R)
|
||||||
|
{
|
||||||
|
linear(R);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T> inline void cv::Affine3<T>::rotation(const Vec3& rvec)
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::rotation(const Vec3& rvec)
|
||||||
{
|
{
|
||||||
double rx = rvec[0], ry = rvec[1], rz = rvec[2];
|
double rx = rvec[0], ry = rvec[1], rz = rvec[2];
|
||||||
double theta = std::sqrt(rx*rx + ry*ry + rz*rz);
|
double theta = std::sqrt(rx*rx + ry*ry + rz*rz);
|
||||||
@ -215,7 +237,8 @@ template<typename T> inline void cv::Affine3<T>::rotation(const Vec3& rvec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
|
//Combines rotation methods above. Suports 3x3, 1x3, 3x1 sizes of data matrix;
|
||||||
template<typename T> inline void cv::Affine3<T>::rotation(const cv::Mat& data)
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::rotation(const cv::Mat& data)
|
||||||
{
|
{
|
||||||
CV_Assert(data.type() == cv::DataType<T>::type);
|
CV_Assert(data.type() == cv::DataType<T>::type);
|
||||||
|
|
||||||
@ -235,25 +258,34 @@ template<typename T> inline void cv::Affine3<T>::rotation(const cv::Mat& data)
|
|||||||
CV_Assert(!"Input marix can be 3x3, 1x3 or 3x1");
|
CV_Assert(!"Input marix can be 3x3, 1x3 or 3x1");
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline void cv::Affine3<T>::rotation(float_type alpha, float_type beta, float_type gamma)
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::rotation(float_type alpha, float_type beta, float_type gamma)
|
||||||
{
|
{
|
||||||
rotation(Vec3(alpha, beta, gamma));
|
rotation(Vec3(alpha, beta, gamma));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline void cv::Affine3<T>::linear(const Mat3& L)
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::linear(const Mat3& L)
|
||||||
{
|
{
|
||||||
matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1]; matrix.val[ 2] = L.val[2];
|
matrix.val[0] = L.val[0]; matrix.val[1] = L.val[1]; matrix.val[ 2] = L.val[2];
|
||||||
matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4]; matrix.val[ 6] = L.val[5];
|
matrix.val[4] = L.val[3]; matrix.val[5] = L.val[4]; matrix.val[ 6] = L.val[5];
|
||||||
matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7]; matrix.val[10] = L.val[8];
|
matrix.val[8] = L.val[6]; matrix.val[9] = L.val[7]; matrix.val[10] = L.val[8];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline void cv::Affine3<T>::translation(const Vec3& t)
|
template<typename T> inline
|
||||||
|
void cv::Affine3<T>::translation(const Vec3& t)
|
||||||
{
|
{
|
||||||
matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2];
|
matrix.val[3] = t[0]; matrix.val[7] = t[1]; matrix.val[11] = t[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline typename cv::Affine3<T>::Mat3 cv::Affine3<T>::rotation() const { return linear(); }
|
template<typename T> inline
|
||||||
template<typename T> inline typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear() const
|
typename cv::Affine3<T>::Mat3 cv::Affine3<T>::rotation() const
|
||||||
|
{
|
||||||
|
return linear();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T> inline
|
||||||
|
typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear() const
|
||||||
{
|
{
|
||||||
typename cv::Affine3<T>::Mat3 R;
|
typename cv::Affine3<T>::Mat3 R;
|
||||||
R.val[0] = matrix.val[0]; R.val[1] = matrix.val[1]; R.val[2] = matrix.val[ 2];
|
R.val[0] = matrix.val[0]; R.val[1] = matrix.val[1]; R.val[2] = matrix.val[ 2];
|
||||||
@ -262,17 +294,20 @@ template<typename T> inline typename cv::Affine3<T>::Mat3 cv::Affine3<T>::linear
|
|||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
|
template<typename T> inline
|
||||||
|
typename cv::Affine3<T>::Vec3 cv::Affine3<T>::translation() const
|
||||||
{
|
{
|
||||||
return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]);
|
return Vec3(matrix.val[3], matrix.val[7], matrix.val[11]);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::Affine3<T>::inv(int method) const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::Affine3<T>::inv(int method) const
|
||||||
{
|
{
|
||||||
return matrix.inv(method);
|
return matrix.inv(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R) const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R) const
|
||||||
{
|
{
|
||||||
Mat3 Lc = linear();
|
Mat3 Lc = linear();
|
||||||
Vec3 tc = translation();
|
Vec3 tc = translation();
|
||||||
@ -295,7 +330,8 @@ template<typename T> inline cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::Affine3<T>::translate(const Vec3& t) const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::Affine3<T>::translate(const Vec3& t) const
|
||||||
{
|
{
|
||||||
Mat4 m = matrix;
|
Mat4 m = matrix;
|
||||||
m.val[ 3] += t[0];
|
m.val[ 3] += t[0];
|
||||||
@ -304,22 +340,26 @@ template<typename T> inline cv::Affine3<T> cv::Affine3<T>::translate(const Vec3&
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::Affine3<T>::concatenate(const Affine3<T>& affine) const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::Affine3<T>::concatenate(const Affine3<T>& affine) const
|
||||||
{
|
{
|
||||||
return (*this).rotate(affine.rotation()).translate(affine.translation());
|
return (*this).rotate(affine.rotation()).translate(affine.translation());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> template <typename Y> inline cv::Affine3<T>::operator Affine3<Y>() const
|
template<typename T> template <typename Y> inline
|
||||||
|
cv::Affine3<T>::operator Affine3<Y>() const
|
||||||
{
|
{
|
||||||
return Affine3<Y>(matrix);
|
return Affine3<Y>(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
|
||||||
{
|
{
|
||||||
return affine2.concatenate(affine1);
|
return affine2.concatenate(affine1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename V> inline V cv::operator*(const cv::Affine3<T>& affine, const V& v)
|
template<typename T, typename V> inline
|
||||||
|
V cv::operator*(const cv::Affine3<T>& affine, const V& v)
|
||||||
{
|
{
|
||||||
const typename Affine3<T>::Mat4& m = affine.matrix;
|
const typename Affine3<T>::Mat4& m = affine.matrix;
|
||||||
|
|
||||||
@ -330,7 +370,8 @@ template<typename T, typename V> inline V cv::operator*(const cv::Affine3<T>& af
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
|
static inline
|
||||||
|
cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
|
||||||
{
|
{
|
||||||
const cv::Matx44f& m = affine.matrix;
|
const cv::Matx44f& m = affine.matrix;
|
||||||
cv::Vec3f r;
|
cv::Vec3f r;
|
||||||
@ -340,7 +381,8 @@ inline cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
|
static inline
|
||||||
|
cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
|
||||||
{
|
{
|
||||||
const cv::Matx44d& m = affine.matrix;
|
const cv::Matx44d& m = affine.matrix;
|
||||||
cv::Vec3d r;
|
cv::Vec3d r;
|
||||||
@ -350,20 +392,25 @@ inline cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
|
#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>& affine)
|
||||||
{
|
{
|
||||||
cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
|
cv::Mat(4, 4, cv::DataType<T>::type, affine.matrix().data()).copyTo(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::Affine3(const Eigen::Transform<T, 3, Eigen::Affine>& affine)
|
||||||
{
|
{
|
||||||
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
|
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> a = affine;
|
||||||
cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
|
cv::Mat(4, 4, cv::DataType<T>::type, a.matrix().data()).copyTo(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>() const
|
||||||
{
|
{
|
||||||
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
|
Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)> r;
|
||||||
cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
|
cv::Mat hdr(4, 4, cv::DataType<T>::type, r.matrix().data());
|
||||||
@ -371,7 +418,8 @@ template<typename T> inline cv::Affine3<T>::operator Eigen::Transform<T, 3, Eige
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> inline cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
|
template<typename T> inline
|
||||||
|
cv::Affine3<T>::operator Eigen::Transform<T, 3, Eigen::Affine>() const
|
||||||
{
|
{
|
||||||
return this->operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>();
|
return this->operator Eigen::Transform<T, 3, Eigen::Affine, (Eigen::RowMajor)>();
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
// copy or use the software.
|
// copy or use the software.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// License Agreement
|
// License Agreement
|
||||||
// For Open Source Computer Vision Library
|
// For Open Source Computer Vision Library
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Third party copyrights are property of their respective owners.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
@ -1888,7 +1889,6 @@ template<> CV_EXPORTS void Ptr<IplImage>::delete_obj();
|
|||||||
template<> CV_EXPORTS void Ptr<CvMatND>::delete_obj();
|
template<> CV_EXPORTS void Ptr<CvMatND>::delete_obj();
|
||||||
template<> CV_EXPORTS void Ptr<CvSparseMat>::delete_obj();
|
template<> CV_EXPORTS void Ptr<CvSparseMat>::delete_obj();
|
||||||
template<> CV_EXPORTS void Ptr<CvMemStorage>::delete_obj();
|
template<> CV_EXPORTS void Ptr<CvMemStorage>::delete_obj();
|
||||||
template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
|
|
||||||
|
|
||||||
////////////// convenient wrappers for operating old-style dynamic structures //////////////
|
////////////// convenient wrappers for operating old-style dynamic structures //////////////
|
||||||
|
|
||||||
@ -2228,7 +2228,7 @@ template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
|
|||||||
const SeqIterator<_Tp>& b)
|
const SeqIterator<_Tp>& b)
|
||||||
{
|
{
|
||||||
ptrdiff_t delta = a.index - b.index, n = a.seq->total;
|
ptrdiff_t delta = a.index - b.index, n = a.seq->total;
|
||||||
if( std::abs(static_cast<long>(delta)) > n )
|
if( delta > n || delta < -n )
|
||||||
delta += delta < 0 ? n : -n;
|
delta += delta < 0 ? n : -n;
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
#define CV_CPU_NEON 11
|
#define CV_CPU_NEON 11
|
||||||
#define CV_HARDWARE_MAX_FEATURE 255
|
#define CV_HARDWARE_MAX_FEATURE 255
|
||||||
|
|
||||||
// disable SSE/AVX/NEON headers for NVCC compiler
|
// do not include SSE/AVX/NEON headers for NVCC compiler
|
||||||
#ifndef __CUDACC__
|
#ifndef __CUDACC__
|
||||||
|
|
||||||
#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
|
#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
#ifndef OPENCV_NOSTL_TRANSITIONAL
|
#ifndef OPENCV_NOSTL_TRANSITIONAL
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
# include <utility>
|
# include <utility>
|
||||||
|
# include <cstdlib> //for abs(int)
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
@ -70,19 +71,31 @@ namespace cv
|
|||||||
using std::max;
|
using std::max;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
using std::swap;
|
using std::swap;
|
||||||
|
using std::sqrt;
|
||||||
|
using std::exp;
|
||||||
|
using std::pow;
|
||||||
|
using std::log;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
static inline uchar abs(uchar a) { return a; }
|
||||||
|
static inline ushort abs(ushort a) { return a; }
|
||||||
|
static inline unsigned abs(unsigned a) { return a; }
|
||||||
|
static inline uint64 abs(uint64 a) { return a; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
template<typename T> inline T min(T a, T b) { return a < b ? a : b; }
|
template<typename T> static inline T min(T a, T b) { return a < b ? a : b; }
|
||||||
template<typename T> inline T max(T a, T b) { return a > b ? a : b; }
|
template<typename T> static inline T max(T a, T b) { return a > b ? a : b; }
|
||||||
template<typename T> inline T abs(T a) { return a < 0 ? -a : a; }
|
template<typename T> static inline T abs(T a) { return a < 0 ? -a : a; }
|
||||||
template<typename T> inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
template<typename T> static inline void swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||||||
|
|
||||||
template<> inline uchar abs(uchar a) { return a; }
|
template<> inline uchar abs(uchar a) { return a; }
|
||||||
template<> inline ushort abs(ushort a) { return a; }
|
template<> inline ushort abs(ushort a) { return a; }
|
||||||
template<> inline uint abs(uint a) { return a; }
|
template<> inline unsigned abs(unsigned a) { return a; }
|
||||||
template<> inline uint64 abs(uint64 a) { return a; }
|
template<> inline uint64 abs(uint64 a) { return a; }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -483,17 +496,22 @@ bool operator != (const Ptr<_Tp>& a, const Ptr<_Tp2>& b)
|
|||||||
|
|
||||||
////////////////////////// cv::String implementation /////////////////////////
|
////////////////////////// cv::String implementation /////////////////////////
|
||||||
|
|
||||||
inline String::String() : cstr_(0), len_(0)
|
inline
|
||||||
{
|
String::String()
|
||||||
}
|
: cstr_(0), len_(0)
|
||||||
|
{}
|
||||||
|
|
||||||
inline String::String(const String& str) : cstr_(str.cstr_), len_(str.len_)
|
inline
|
||||||
|
String::String(const String& str)
|
||||||
|
: cstr_(str.cstr_), len_(str.len_)
|
||||||
{
|
{
|
||||||
if (cstr_)
|
if (cstr_)
|
||||||
CV_XADD(((int*)cstr_)-1, 1);
|
CV_XADD(((int*)cstr_)-1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(const String& str, size_t pos, size_t len) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const String& str, size_t pos, size_t len)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
pos = min(pos, str.len_);
|
pos = min(pos, str.len_);
|
||||||
len = min(str.len_ - pos, len);
|
len = min(str.len_ - pos, len);
|
||||||
@ -508,32 +526,41 @@ inline String::String(const String& str, size_t pos, size_t len) : cstr_(0), len
|
|||||||
memcpy(allocate(len), str.cstr_ + pos, len);
|
memcpy(allocate(len), str.cstr_ + pos, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(const char* s) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const char* s)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
if (!s) return;
|
if (!s) return;
|
||||||
size_t len = strlen(s);
|
size_t len = strlen(s);
|
||||||
memcpy(allocate(len), s, len);
|
memcpy(allocate(len), s, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(const char* s, size_t n) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const char* s, size_t n)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
if (!n) return;
|
if (!n) return;
|
||||||
memcpy(allocate(n), s, n);
|
memcpy(allocate(n), s, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(size_t n, char c) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(size_t n, char c)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
memset(allocate(n), c, n);
|
memset(allocate(n), c, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(const char* first, const char* last) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const char* first, const char* last)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
size_t len = (size_t)(last - first);
|
size_t len = (size_t)(last - first);
|
||||||
memcpy(allocate(len), first, len);
|
memcpy(allocate(len), first, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Iterator>
|
template<typename Iterator> inline
|
||||||
inline String::String(Iterator first, Iterator last) : cstr_(0), len_(0)
|
String::String(Iterator first, Iterator last)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
size_t len = (size_t)(last - first);
|
size_t len = (size_t)(last - first);
|
||||||
char* str = allocate(len);
|
char* str = allocate(len);
|
||||||
@ -544,12 +571,14 @@ inline String::String(Iterator first, Iterator last) : cstr_(0), len_(0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::~String()
|
inline
|
||||||
|
String::~String()
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String& String::operator=(const String& str)
|
inline
|
||||||
|
String& String::operator=(const String& str)
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
|
if (str.cstr_) CV_XADD(((int*)str.cstr_)-1, 1);
|
||||||
@ -558,7 +587,8 @@ inline String& String::operator=(const String& str)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String& String::operator=(const char* s)
|
inline
|
||||||
|
String& String::operator=(const char* s)
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
if (!s) return *this;
|
if (!s) return *this;
|
||||||
@ -567,82 +597,97 @@ inline String& String::operator=(const char* s)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String& String::operator=(char c)
|
inline
|
||||||
|
String& String::operator=(char c)
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
allocate(1)[0] = c;
|
allocate(1)[0] = c;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::size() const
|
inline
|
||||||
|
size_t String::size() const
|
||||||
{
|
{
|
||||||
return len_;
|
return len_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::length() const
|
inline
|
||||||
|
size_t String::length() const
|
||||||
{
|
{
|
||||||
return len_;
|
return len_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char String::operator[](size_t idx) const
|
inline
|
||||||
|
char String::operator[](size_t idx) const
|
||||||
{
|
{
|
||||||
return cstr_[idx];
|
return cstr_[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char String::operator[](int idx) const
|
inline
|
||||||
|
char String::operator[](int idx) const
|
||||||
{
|
{
|
||||||
return cstr_[idx];
|
return cstr_[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char* String::begin() const
|
inline
|
||||||
|
const char* String::begin() const
|
||||||
{
|
{
|
||||||
return cstr_;
|
return cstr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char* String::end() const
|
inline
|
||||||
|
const char* String::end() const
|
||||||
{
|
{
|
||||||
return len_ ? cstr_ + 1 : 0;
|
return len_ ? cstr_ + 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool String::empty() const
|
inline
|
||||||
|
bool String::empty() const
|
||||||
{
|
{
|
||||||
return len_ == 0;
|
return len_ == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const char* String::c_str() const
|
inline
|
||||||
|
const char* String::c_str() const
|
||||||
{
|
{
|
||||||
return cstr_ ? cstr_ : "";
|
return cstr_ ? cstr_ : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void String::swap(String& str)
|
inline
|
||||||
|
void String::swap(String& str)
|
||||||
{
|
{
|
||||||
cv::swap(cstr_, str.cstr_);
|
cv::swap(cstr_, str.cstr_);
|
||||||
cv::swap(len_, str.len_);
|
cv::swap(len_, str.len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void String::clear()
|
inline
|
||||||
|
void String::clear()
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int String::compare(const char* s) const
|
inline
|
||||||
|
int String::compare(const char* s) const
|
||||||
{
|
{
|
||||||
if (cstr_ == s) return 0;
|
if (cstr_ == s) return 0;
|
||||||
return strcmp(c_str(), s);
|
return strcmp(c_str(), s);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int String::compare(const String& str) const
|
inline
|
||||||
|
int String::compare(const String& str) const
|
||||||
{
|
{
|
||||||
if (cstr_ == str.cstr_) return 0;
|
if (cstr_ == str.cstr_) return 0;
|
||||||
return strcmp(c_str(), str.c_str());
|
return strcmp(c_str(), str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String String::substr(size_t pos, size_t len) const
|
inline
|
||||||
|
String String::substr(size_t pos, size_t len) const
|
||||||
{
|
{
|
||||||
return String(*this, pos, len);
|
return String(*this, pos, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find(const char* s, size_t pos, size_t n) const
|
inline
|
||||||
|
size_t String::find(const char* s, size_t pos, size_t n) const
|
||||||
{
|
{
|
||||||
if (n == 0 || pos + n > len_) return npos;
|
if (n == 0 || pos + n > len_) return npos;
|
||||||
const char* lmax = cstr_ + len_ - n;
|
const char* lmax = cstr_ + len_ - n;
|
||||||
@ -655,17 +700,20 @@ inline size_t String::find(const char* s, size_t pos, size_t n) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find(char c, size_t pos) const
|
inline
|
||||||
|
size_t String::find(char c, size_t pos) const
|
||||||
{
|
{
|
||||||
return find(&c, pos, 1);
|
return find(&c, pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find(const String& str, size_t pos) const
|
inline
|
||||||
|
size_t String::find(const String& str, size_t pos) const
|
||||||
{
|
{
|
||||||
return find(str.c_str(), pos, str.len_);
|
return find(str.c_str(), pos, str.len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find(const char* s, size_t pos) const
|
inline
|
||||||
|
size_t String::find(const char* s, size_t pos) const
|
||||||
{
|
{
|
||||||
if (pos >= len_ || !s[0]) return npos;
|
if (pos >= len_ || !s[0]) return npos;
|
||||||
const char* lmax = cstr_ + len_;
|
const char* lmax = cstr_ + len_;
|
||||||
@ -681,7 +729,8 @@ inline size_t String::find(const char* s, size_t pos) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::rfind(const char* s, size_t pos, size_t n) const
|
inline
|
||||||
|
size_t String::rfind(const char* s, size_t pos, size_t n) const
|
||||||
{
|
{
|
||||||
if (n > len_) return npos;
|
if (n > len_) return npos;
|
||||||
if (pos > len_ - n) pos = len_ - n;
|
if (pos > len_ - n) pos = len_ - n;
|
||||||
@ -694,22 +743,26 @@ inline size_t String::rfind(const char* s, size_t pos, size_t n) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::rfind(char c, size_t pos) const
|
inline
|
||||||
|
size_t String::rfind(char c, size_t pos) const
|
||||||
{
|
{
|
||||||
return rfind(&c, pos, 1);
|
return rfind(&c, pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::rfind(const String& str, size_t pos) const
|
inline
|
||||||
|
size_t String::rfind(const String& str, size_t pos) const
|
||||||
{
|
{
|
||||||
return rfind(str.c_str(), pos, str.len_);
|
return rfind(str.c_str(), pos, str.len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::rfind(const char* s, size_t pos) const
|
inline
|
||||||
|
size_t String::rfind(const char* s, size_t pos) const
|
||||||
{
|
{
|
||||||
return rfind(s, pos, strlen(s));
|
return rfind(s, pos, strlen(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_first_of(const char* s, size_t pos, size_t n) const
|
inline
|
||||||
|
size_t String::find_first_of(const char* s, size_t pos, size_t n) const
|
||||||
{
|
{
|
||||||
if (n == 0 || pos + n > len_) return npos;
|
if (n == 0 || pos + n > len_) return npos;
|
||||||
const char* lmax = cstr_ + len_;
|
const char* lmax = cstr_ + len_;
|
||||||
@ -722,17 +775,20 @@ inline size_t String::find_first_of(const char* s, size_t pos, size_t n) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_first_of(char c, size_t pos) const
|
inline
|
||||||
|
size_t String::find_first_of(char c, size_t pos) const
|
||||||
{
|
{
|
||||||
return find_first_of(&c, pos, 1);
|
return find_first_of(&c, pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_first_of(const String& str, size_t pos) const
|
inline
|
||||||
|
size_t String::find_first_of(const String& str, size_t pos) const
|
||||||
{
|
{
|
||||||
return find_first_of(str.c_str(), pos, str.len_);
|
return find_first_of(str.c_str(), pos, str.len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_first_of(const char* s, size_t pos) const
|
inline
|
||||||
|
size_t String::find_first_of(const char* s, size_t pos) const
|
||||||
{
|
{
|
||||||
if (pos >= len_ || !s[0]) return npos;
|
if (pos >= len_ || !s[0]) return npos;
|
||||||
const char* lmax = cstr_ + len_;
|
const char* lmax = cstr_ + len_;
|
||||||
@ -745,7 +801,8 @@ inline size_t String::find_first_of(const char* s, size_t pos) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_last_of(const char* s, size_t pos, size_t n) const
|
inline
|
||||||
|
size_t String::find_last_of(const char* s, size_t pos, size_t n) const
|
||||||
{
|
{
|
||||||
if (pos >= len_) pos = len_ - 1;
|
if (pos >= len_) pos = len_ - 1;
|
||||||
for (const char* i = cstr_ + pos; i >= cstr_; --i)
|
for (const char* i = cstr_ + pos; i >= cstr_; --i)
|
||||||
@ -757,17 +814,20 @@ inline size_t String::find_last_of(const char* s, size_t pos, size_t n) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_last_of(char c, size_t pos) const
|
inline
|
||||||
|
size_t String::find_last_of(char c, size_t pos) const
|
||||||
{
|
{
|
||||||
return find_last_of(&c, pos, 1);
|
return find_last_of(&c, pos, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_last_of(const String& str, size_t pos) const
|
inline
|
||||||
|
size_t String::find_last_of(const String& str, size_t pos) const
|
||||||
{
|
{
|
||||||
return find_last_of(str.c_str(), pos, str.len_);
|
return find_last_of(str.c_str(), pos, str.len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t String::find_last_of(const char* s, size_t pos) const
|
inline
|
||||||
|
size_t String::find_last_of(const char* s, size_t pos) const
|
||||||
{
|
{
|
||||||
if (pos >= len_) pos = len_ - 1;
|
if (pos >= len_) pos = len_ - 1;
|
||||||
for (const char* i = cstr_ + pos; i >= cstr_; --i)
|
for (const char* i = cstr_ + pos; i >= cstr_; --i)
|
||||||
@ -779,7 +839,8 @@ inline size_t String::find_last_of(const char* s, size_t pos) const
|
|||||||
return npos;
|
return npos;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String String::toLowerCase() const
|
inline
|
||||||
|
String String::toLowerCase() const
|
||||||
{
|
{
|
||||||
String res(cstr_, len_);
|
String res(cstr_, len_);
|
||||||
|
|
||||||
@ -791,7 +852,8 @@ inline String String::toLowerCase() const
|
|||||||
|
|
||||||
// ************************* cv::String non-member functions *************************
|
// ************************* cv::String non-member functions *************************
|
||||||
|
|
||||||
inline String operator+ (const String& lhs, const String& rhs)
|
inline
|
||||||
|
String operator + (const String& lhs, const String& rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
s.allocate(lhs.len_ + rhs.len_);
|
s.allocate(lhs.len_ + rhs.len_);
|
||||||
@ -800,7 +862,8 @@ inline String operator+ (const String& lhs, const String& rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (const String& lhs, const char* rhs)
|
inline
|
||||||
|
String operator + (const String& lhs, const char* rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
size_t rhslen = strlen(rhs);
|
size_t rhslen = strlen(rhs);
|
||||||
@ -810,7 +873,8 @@ inline String operator+ (const String& lhs, const char* rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (const char* lhs, const String& rhs)
|
inline
|
||||||
|
String operator + (const char* lhs, const String& rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
size_t lhslen = strlen(lhs);
|
size_t lhslen = strlen(lhs);
|
||||||
@ -820,7 +884,8 @@ inline String operator+ (const char* lhs, const String& rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (const String& lhs, char rhs)
|
inline
|
||||||
|
String operator + (const String& lhs, char rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
s.allocate(lhs.len_ + 1);
|
s.allocate(lhs.len_ + 1);
|
||||||
@ -829,7 +894,8 @@ inline String operator+ (const String& lhs, char rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (char lhs, const String& rhs)
|
inline
|
||||||
|
String operator + (char lhs, const String& rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
s.allocate(rhs.len_ + 1);
|
s.allocate(rhs.len_ + 1);
|
||||||
@ -838,24 +904,24 @@ inline String operator+ (char lhs, const String& rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); }
|
static inline bool operator== (const String& lhs, const String& rhs) { return 0 == lhs.compare(rhs); }
|
||||||
inline bool operator== (const char* lhs, const String& rhs) { return 0 == rhs.compare(lhs); }
|
static inline bool operator== (const char* lhs, const String& rhs) { return 0 == rhs.compare(lhs); }
|
||||||
inline bool operator== (const String& lhs, const char* rhs) { return 0 == lhs.compare(rhs); }
|
static inline bool operator== (const String& lhs, const char* rhs) { return 0 == lhs.compare(rhs); }
|
||||||
inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); }
|
static inline bool operator!= (const String& lhs, const String& rhs) { return 0 != lhs.compare(rhs); }
|
||||||
inline bool operator!= (const char* lhs, const String& rhs) { return 0 != rhs.compare(lhs); }
|
static inline bool operator!= (const char* lhs, const String& rhs) { return 0 != rhs.compare(lhs); }
|
||||||
inline bool operator!= (const String& lhs, const char* rhs) { return 0 != lhs.compare(rhs); }
|
static inline bool operator!= (const String& lhs, const char* rhs) { return 0 != lhs.compare(rhs); }
|
||||||
inline bool operator< (const String& lhs, const String& rhs) { return lhs.compare(rhs) < 0; }
|
static inline bool operator< (const String& lhs, const String& rhs) { return lhs.compare(rhs) < 0; }
|
||||||
inline bool operator< (const char* lhs, const String& rhs) { return rhs.compare(lhs) > 0; }
|
static inline bool operator< (const char* lhs, const String& rhs) { return rhs.compare(lhs) > 0; }
|
||||||
inline bool operator< (const String& lhs, const char* rhs) { return lhs.compare(rhs) < 0; }
|
static inline bool operator< (const String& lhs, const char* rhs) { return lhs.compare(rhs) < 0; }
|
||||||
inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; }
|
static inline bool operator<= (const String& lhs, const String& rhs) { return lhs.compare(rhs) <= 0; }
|
||||||
inline bool operator<= (const char* lhs, const String& rhs) { return rhs.compare(lhs) >= 0; }
|
static inline bool operator<= (const char* lhs, const String& rhs) { return rhs.compare(lhs) >= 0; }
|
||||||
inline bool operator<= (const String& lhs, const char* rhs) { return lhs.compare(rhs) <= 0; }
|
static inline bool operator<= (const String& lhs, const char* rhs) { return lhs.compare(rhs) <= 0; }
|
||||||
inline bool operator> (const String& lhs, const String& rhs) { return lhs.compare(rhs) > 0; }
|
static inline bool operator> (const String& lhs, const String& rhs) { return lhs.compare(rhs) > 0; }
|
||||||
inline bool operator> (const char* lhs, const String& rhs) { return rhs.compare(lhs) < 0; }
|
static inline bool operator> (const char* lhs, const String& rhs) { return rhs.compare(lhs) < 0; }
|
||||||
inline bool operator> (const String& lhs, const char* rhs) { return lhs.compare(rhs) > 0; }
|
static inline bool operator> (const String& lhs, const char* rhs) { return lhs.compare(rhs) > 0; }
|
||||||
inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; }
|
static inline bool operator>= (const String& lhs, const String& rhs) { return lhs.compare(rhs) >= 0; }
|
||||||
inline bool operator>= (const char* lhs, const String& rhs) { return rhs.compare(lhs) <= 0; }
|
static inline bool operator>= (const char* lhs, const String& rhs) { return rhs.compare(lhs) <= 0; }
|
||||||
inline bool operator>= (const String& lhs, const char* rhs) { return lhs.compare(rhs) >= 0; }
|
static inline bool operator>= (const String& lhs, const char* rhs) { return lhs.compare(rhs) >= 0; }
|
||||||
|
|
||||||
} // cv
|
} // cv
|
||||||
|
|
||||||
@ -865,7 +931,11 @@ namespace std
|
|||||||
namespace cv
|
namespace cv
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
template<> inline void swap<cv::String>(cv::String& a, cv::String& b) { a.swap(b); }
|
template<> inline
|
||||||
|
void swap<cv::String>(cv::String& a, cv::String& b)
|
||||||
|
{
|
||||||
|
a.swap(b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //__OPENCV_CORE_CVSTD_HPP__
|
#endif //__OPENCV_CORE_CVSTD_HPP__
|
||||||
|
@ -68,7 +68,9 @@ public:
|
|||||||
typedef Vec<channel_type, channels> vec_type;
|
typedef Vec<channel_type, channels> vec_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline String::String(const std::string& str) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const std::string& str)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
{
|
{
|
||||||
@ -77,7 +79,9 @@ inline String::String(const std::string& str) : cstr_(0), len_(0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::String(const std::string& str, size_t pos, size_t len) : cstr_(0), len_(0)
|
inline
|
||||||
|
String::String(const std::string& str, size_t pos, size_t len)
|
||||||
|
: cstr_(0), len_(0)
|
||||||
{
|
{
|
||||||
size_t strlen = str.size();
|
size_t strlen = str.size();
|
||||||
pos = max(pos, strlen);
|
pos = max(pos, strlen);
|
||||||
@ -86,7 +90,8 @@ inline String::String(const std::string& str, size_t pos, size_t len) : cstr_(0)
|
|||||||
memcpy(allocate(len), str.c_str() + pos, len);
|
memcpy(allocate(len), str.c_str() + pos, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String& String::operator=(const std::string& str)
|
inline
|
||||||
|
String& String::operator = (const std::string& str)
|
||||||
{
|
{
|
||||||
deallocate();
|
deallocate();
|
||||||
if (!str.empty())
|
if (!str.empty())
|
||||||
@ -97,12 +102,14 @@ inline String& String::operator=(const std::string& str)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String::operator std::string() const
|
inline
|
||||||
|
String::operator std::string() const
|
||||||
{
|
{
|
||||||
return std::string(cstr_, len_);
|
return std::string(cstr_, len_);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (const String& lhs, const std::string& rhs)
|
inline
|
||||||
|
String operator + (const String& lhs, const std::string& rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
size_t rhslen = rhs.size();
|
size_t rhslen = rhs.size();
|
||||||
@ -112,7 +119,8 @@ inline String operator+ (const String& lhs, const std::string& rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline String operator+ (const std::string& lhs, const String& rhs)
|
inline
|
||||||
|
String operator + (const std::string& lhs, const String& rhs)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
size_t lhslen = lhs.size();
|
size_t lhslen = lhs.size();
|
||||||
@ -122,30 +130,119 @@ inline String operator+ (const std::string& lhs, const String& rhs)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream& operator << (std::ostream& os, const String& str)
|
inline
|
||||||
{
|
FileNode::operator std::string() const
|
||||||
return os << str.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline FileNode::operator std::string() const
|
|
||||||
{
|
{
|
||||||
String value;
|
String value;
|
||||||
read(*this, value, value);
|
read(*this, value, value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> inline void operator >> (const FileNode& n, std::string& value)
|
template<> inline
|
||||||
|
void operator >> (const FileNode& n, std::string& value)
|
||||||
{
|
{
|
||||||
String val;
|
String val;
|
||||||
read(n, val, val);
|
read(n, val, val);
|
||||||
value = val;
|
value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> inline FileStorage& operator << (FileStorage& fs, const std::string& value)
|
template<> inline
|
||||||
|
FileStorage& operator << (FileStorage& fs, const std::string& value)
|
||||||
{
|
{
|
||||||
return fs << cv::String(value);
|
return fs << cv::String(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
std::ostream& operator << (std::ostream& os, const String& str)
|
||||||
|
{
|
||||||
|
return os << str.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, Ptr<Formatted> fmtd)
|
||||||
|
{
|
||||||
|
fmtd->reset();
|
||||||
|
for(const char* str = fmtd->next(); str; str = fmtd->next())
|
||||||
|
out << str;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Mat& mtx)
|
||||||
|
{
|
||||||
|
return out << Formatter::get()->format(mtx);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
|
||||||
|
{
|
||||||
|
return out << Formatter::get()->format(Mat(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const std::vector<Point3_<_Tp> >& vec)
|
||||||
|
{
|
||||||
|
return out << Formatter::get()->format(Mat(vec));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename _Tp, int m, int n> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Matx<_Tp, m, n>& matx)
|
||||||
|
{
|
||||||
|
return out << Formatter::get()->format(matx);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Point_<_Tp>& p)
|
||||||
|
{
|
||||||
|
out << "[" << p.x << ", " << p.y << "]";
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Point3_<_Tp>& p)
|
||||||
|
{
|
||||||
|
out << "[" << p.x << ", " << p.y << ", " << p.z << "]";
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp, int n> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Vec<_Tp, n>& vec)
|
||||||
|
{
|
||||||
|
out << "[";
|
||||||
|
|
||||||
|
if(Vec<_Tp, n>::depth < CV_32F)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n - 1; ++i) {
|
||||||
|
out << (int)vec[i] << ", ";
|
||||||
|
}
|
||||||
|
out << (int)vec[n-1] << "]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < n - 1; ++i) {
|
||||||
|
out << vec[i] << ", ";
|
||||||
|
}
|
||||||
|
out << vec[n-1] << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Size_<_Tp>& size)
|
||||||
|
{
|
||||||
|
return out << "[" << size.width << " x " << size.height << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename _Tp> static inline
|
||||||
|
std::ostream& operator << (std::ostream& out, const Rect_<_Tp>& rect)
|
||||||
|
{
|
||||||
|
return out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // OPENCV_NOSTL
|
#endif // OPENCV_NOSTL
|
||||||
} // cv
|
} // cv
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Third party copyrights are property of their respective owners.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
@ -40,12 +41,10 @@
|
|||||||
//
|
//
|
||||||
//M*/
|
//M*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __OPENCV_CORE_EIGEN_HPP__
|
#ifndef __OPENCV_CORE_EIGEN_HPP__
|
||||||
#define __OPENCV_CORE_EIGEN_HPP__
|
#define __OPENCV_CORE_EIGEN_HPP__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#include "opencv2/core/core_c.h"
|
|
||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
|
|
||||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||||
@ -57,7 +56,7 @@
|
|||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols>
|
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
|
||||||
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
|
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src, Mat& dst )
|
||||||
{
|
{
|
||||||
if( !(src.Flags & Eigen::RowMajorBit) )
|
if( !(src.Flags & Eigen::RowMajorBit) )
|
||||||
@ -75,7 +74,7 @@ void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Matx case
|
// Matx case
|
||||||
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols>
|
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
|
||||||
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
|
void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& src,
|
||||||
Matx<_Tp, _rows, _cols>& dst )
|
Matx<_Tp, _rows, _cols>& dst )
|
||||||
{
|
{
|
||||||
@ -89,14 +88,14 @@ void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols>
|
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
|
||||||
void cv2eigen( const Mat& src,
|
void cv2eigen( const Mat& src,
|
||||||
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
|
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
|
||||||
{
|
{
|
||||||
CV_DbgAssert(src.rows == _rows && src.cols == _cols);
|
CV_DbgAssert(src.rows == _rows && src.cols == _cols);
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
if( src.type() == _dst.type() )
|
if( src.type() == _dst.type() )
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
@ -107,46 +106,42 @@ void cv2eigen( const Mat& src,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Mat(src.t()).convertTo(_dst, _dst.type());
|
Mat(src.t()).convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
src.convertTo(_dst, _dst.type());
|
src.convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matx case
|
// Matx case
|
||||||
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols>
|
template<typename _Tp, int _rows, int _cols, int _options, int _maxRows, int _maxCols> static inline
|
||||||
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
||||||
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
|
Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCols>& dst )
|
||||||
{
|
{
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
Mat(src).copyTo(_dst);
|
Mat(src).copyTo(_dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> static inline
|
||||||
void cv2eigen( const Mat& src,
|
void cv2eigen( const Mat& src,
|
||||||
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
|
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
|
||||||
{
|
{
|
||||||
dst.resize(src.rows, src.cols);
|
dst.resize(src.rows, src.cols);
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
if( src.type() == _dst.type() )
|
if( src.type() == _dst.type() )
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
@ -157,40 +152,36 @@ void cv2eigen( const Mat& src,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Mat(src.t()).convertTo(_dst, _dst.type());
|
Mat(src.t()).convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
src.convertTo(_dst, _dst.type());
|
src.convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matx case
|
// Matx case
|
||||||
template<typename _Tp, int _rows, int _cols>
|
template<typename _Tp, int _rows, int _cols> static inline
|
||||||
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
void cv2eigen( const Matx<_Tp, _rows, _cols>& src,
|
||||||
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
|
Eigen::Matrix<_Tp, Eigen::Dynamic, Eigen::Dynamic>& dst )
|
||||||
{
|
{
|
||||||
dst.resize(_rows, _cols);
|
dst.resize(_rows, _cols);
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
const Mat _dst(_cols, _rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
const Mat _dst(_rows, _cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
Mat(src).copyTo(_dst);
|
Mat(src).copyTo(_dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> static inline
|
||||||
void cv2eigen( const Mat& src,
|
void cv2eigen( const Mat& src,
|
||||||
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
|
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
|
||||||
{
|
{
|
||||||
@ -199,25 +190,23 @@ void cv2eigen( const Mat& src,
|
|||||||
|
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
if( src.type() == _dst.type() )
|
if( src.type() == _dst.type() )
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
else
|
else
|
||||||
Mat(src.t()).convertTo(_dst, _dst.type());
|
Mat(src.t()).convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
src.convertTo(_dst, _dst.type());
|
src.convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matx case
|
// Matx case
|
||||||
template<typename _Tp, int _rows>
|
template<typename _Tp, int _rows> static inline
|
||||||
void cv2eigen( const Matx<_Tp, _rows, 1>& src,
|
void cv2eigen( const Matx<_Tp, _rows, 1>& src,
|
||||||
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
|
Eigen::Matrix<_Tp, Eigen::Dynamic, 1>& dst )
|
||||||
{
|
{
|
||||||
@ -225,22 +214,20 @@ void cv2eigen( const Matx<_Tp, _rows, 1>& src,
|
|||||||
|
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(1, _rows, DataType<_Tp>::type,
|
const Mat _dst(1, _rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(_rows, 1, DataType<_Tp>::type,
|
const Mat _dst(_rows, 1, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
src.copyTo(_dst);
|
src.copyTo(_dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> static inline
|
||||||
void cv2eigen( const Mat& src,
|
void cv2eigen( const Mat& src,
|
||||||
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
|
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
|
||||||
{
|
{
|
||||||
@ -248,49 +235,41 @@ void cv2eigen( const Mat& src,
|
|||||||
dst.resize(src.cols);
|
dst.resize(src.cols);
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
const Mat _dst(src.cols, src.rows, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
if( src.type() == _dst.type() )
|
if( src.type() == _dst.type() )
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
else
|
else
|
||||||
Mat(src.t()).convertTo(_dst, _dst.type());
|
Mat(src.t()).convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
const Mat _dst(src.rows, src.cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
src.convertTo(_dst, _dst.type());
|
src.convertTo(_dst, _dst.type());
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Matx
|
//Matx
|
||||||
template<typename _Tp, int _cols>
|
template<typename _Tp, int _cols> static inline
|
||||||
void cv2eigen( const Matx<_Tp, 1, _cols>& src,
|
void cv2eigen( const Matx<_Tp, 1, _cols>& src,
|
||||||
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
|
Eigen::Matrix<_Tp, 1, Eigen::Dynamic>& dst )
|
||||||
{
|
{
|
||||||
dst.resize(_cols);
|
dst.resize(_cols);
|
||||||
if( !(dst.Flags & Eigen::RowMajorBit) )
|
if( !(dst.Flags & Eigen::RowMajorBit) )
|
||||||
{
|
{
|
||||||
Mat _dst(_cols, 1, DataType<_Tp>::type,
|
const Mat _dst(_cols, 1, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
transpose(src, _dst);
|
transpose(src, _dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mat _dst(1, _cols, DataType<_Tp>::type,
|
const Mat _dst(1, _cols, DataType<_Tp>::type,
|
||||||
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
dst.data(), (size_t)(dst.stride()*sizeof(_Tp)));
|
||||||
Mat(src).copyTo(_dst);
|
Mat(src).copyTo(_dst);
|
||||||
CV_DbgAssert(_dst.data == (uchar*)dst.data());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // cv
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -47,11 +47,6 @@
|
|||||||
# error mat.inl.hpp header must be compiled as C++
|
# error mat.inl.hpp header must be compiled as C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SKIP_INCLUDES
|
|
||||||
#include <limits.h>
|
|
||||||
#include <string.h>
|
|
||||||
#endif // SKIP_INCLUDES
|
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
#ifndef __OPENCV_OPENGL_INTEROP_HPP__
|
#ifndef __OPENCV_OPENGL_INTEROP_HPP__
|
||||||
#define __OPENCV_OPENGL_INTEROP_HPP__
|
#define __OPENCV_OPENGL_INTEROP_HPP__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
|
|
||||||
namespace cv { namespace ogl {
|
namespace cv { namespace ogl {
|
||||||
@ -269,7 +267,7 @@ namespace cv { namespace gpu {
|
|||||||
//! set a CUDA device to use OpenGL interoperability
|
//! set a CUDA device to use OpenGL interoperability
|
||||||
CV_EXPORTS void setGlDevice(int device = 0);
|
CV_EXPORTS void setGlDevice(int device = 0);
|
||||||
|
|
||||||
}}
|
}} // cv::gpu
|
||||||
|
|
||||||
namespace cv {
|
namespace cv {
|
||||||
|
|
||||||
@ -278,6 +276,4 @@ template <> CV_EXPORTS void Ptr<cv::ogl::Texture2D::Impl>::delete_obj();
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // __OPENCV_OPENGL_INTEROP_HPP__
|
#endif // __OPENCV_OPENGL_INTEROP_HPP__
|
||||||
|
@ -47,12 +47,7 @@
|
|||||||
# error operations.hpp header must be compiled as C++
|
# error operations.hpp header must be compiled as C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SKIP_INCLUDES
|
#include <cstdio>
|
||||||
#include <string.h>
|
|
||||||
#include <limits.h>
|
|
||||||
#endif // SKIP_INCLUDES
|
|
||||||
|
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
@ -356,6 +351,7 @@ inline unsigned RNG::next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////// LineIterator ////////////////////////////////////////
|
///////////////////////////////////////// LineIterator ////////////////////////////////////////
|
||||||
|
|
||||||
inline
|
inline
|
||||||
@ -398,39 +394,8 @@ template<typename _Tp> static inline _Tp randu()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
class CV_EXPORTS Formatted
|
///////////////////////////////// Formatted output of cv::Mat /////////////////////////////////
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual const char* next() = 0;
|
|
||||||
virtual void reset() = 0;
|
|
||||||
virtual ~Formatted();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CV_EXPORTS Formatter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum { FMT_MATLAB = 0,
|
|
||||||
FMT_CSV = 1,
|
|
||||||
FMT_PYTHON = 2,
|
|
||||||
FMT_NUMPY = 3,
|
|
||||||
FMT_C = 4,
|
|
||||||
FMT_DEFAULT = FMT_MATLAB
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~Formatter();
|
|
||||||
|
|
||||||
virtual Ptr<Formatted> format(const Mat& mtx) const = 0;
|
|
||||||
|
|
||||||
virtual void set32fPrecision(int p = 8) = 0;
|
|
||||||
virtual void set64fPrecision(int p = 16) = 0;
|
|
||||||
virtual void setMultiline(bool ml = true) = 0;
|
|
||||||
|
|
||||||
static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
Ptr<Formatted> format(InputArray mtx, int fmt)
|
Ptr<Formatted> format(InputArray mtx, int fmt)
|
||||||
@ -438,111 +403,53 @@ Ptr<Formatted> format(InputArray mtx, int fmt)
|
|||||||
return Formatter::get(fmt)->format(mtx.getMat());
|
return Formatter::get(fmt)->format(mtx.getMat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
std::ostream& operator << (std::ostream& out, Ptr<Formatted> fmtd)
|
int print(Ptr<Formatted> fmtd, FILE* stream = stdout)
|
||||||
{
|
{
|
||||||
|
int written = 0;
|
||||||
fmtd->reset();
|
fmtd->reset();
|
||||||
for(const char* str = fmtd->next(); str; str = fmtd->next())
|
for(const char* str = fmtd->next(); str; str = fmtd->next())
|
||||||
out << str;
|
written += fputs(str, stream);
|
||||||
return out;
|
|
||||||
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
std::ostream& operator << (std::ostream& out, const Mat& mtx)
|
int print(const Mat& mtx, FILE* stream = stdout)
|
||||||
{
|
{
|
||||||
return out << Formatter::get()->format(mtx);
|
return print(Formatter::get()->format(mtx), stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
std::ostream& operator << (std::ostream& out, const std::vector<Point_<_Tp> >& vec)
|
int print(const std::vector<Point_<_Tp> >& vec, FILE* stream = stdout)
|
||||||
{
|
{
|
||||||
return out << Formatter::get()->format(Mat(vec));
|
return print(Formatter::get()->format(Mat(vec)), stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename _Tp> static inline
|
template<typename _Tp> static inline
|
||||||
std::ostream& operator << (std::ostream& out, const std::vector<Point3_<_Tp> >& vec)
|
int print(const std::vector<Point3_<_Tp> >& vec, FILE* stream = stdout)
|
||||||
{
|
{
|
||||||
return out << Formatter::get()->format(Mat(vec));
|
return print(Formatter::get()->format(Mat(vec)), stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename _Tp, int m, int n> static inline
|
||||||
/** Writes a Matx to an output stream.
|
int print(const Matx<_Tp, m, n>& matx, FILE* stream = stdout)
|
||||||
*/
|
|
||||||
template<typename _Tp, int m, int n> inline
|
|
||||||
std::ostream& operator << (std::ostream& out, const Matx<_Tp, m, n>& matx)
|
|
||||||
{
|
{
|
||||||
return out << Formatter::get()->format(matx);
|
return print(Formatter::get()->format(matx), stream);
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a point to an output stream in Matlab notation
|
|
||||||
*/
|
|
||||||
template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const Point_<_Tp>& p)
|
|
||||||
{
|
|
||||||
out << "[" << p.x << ", " << p.y << "]";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a point to an output stream in Matlab notation
|
|
||||||
*/
|
|
||||||
template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const Point3_<_Tp>& p)
|
|
||||||
{
|
|
||||||
out << "[" << p.x << ", " << p.y << ", " << p.z << "]";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a Vec to an output stream. Format example : [10, 20, 30]
|
|
||||||
*/
|
|
||||||
template<typename _Tp, int n> inline std::ostream& operator<<(std::ostream& out, const Vec<_Tp, n>& vec)
|
|
||||||
{
|
|
||||||
out << "[";
|
|
||||||
|
|
||||||
if(Vec<_Tp, n>::depth < CV_32F)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < n - 1; ++i) {
|
|
||||||
out << (int)vec[i] << ", ";
|
|
||||||
}
|
|
||||||
out << (int)vec[n-1] << "]";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < n - 1; ++i) {
|
|
||||||
out << vec[i] << ", ";
|
|
||||||
}
|
|
||||||
out << vec[n-1] << "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a Size_ to an output stream. Format example : [640 x 480]
|
|
||||||
*/
|
|
||||||
template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const Size_<_Tp>& size)
|
|
||||||
{
|
|
||||||
out << "[" << size.width << " x " << size.height << "]";
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Writes a Rect_ to an output stream. Format example : [640 x 480 from (10, 20)]
|
|
||||||
*/
|
|
||||||
template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const Rect_<_Tp>& rect)
|
|
||||||
{
|
|
||||||
out << "[" << rect.width << " x " << rect.height << " from (" << rect.x << ", " << rect.y << ")]";
|
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////// Algorithm //////////////////////////////////////////
|
////////////////////////////////////////// Algorithm //////////////////////////////////////////
|
||||||
|
|
||||||
template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const String& name)
|
template<typename _Tp> inline
|
||||||
|
Ptr<_Tp> Algorithm::create(const String& name)
|
||||||
{
|
{
|
||||||
return _create(name).ptr<_Tp>();
|
return _create(name).ptr<_Tp>();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> inline
|
||||||
inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
|
void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
|
||||||
{
|
{
|
||||||
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
|
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
|
||||||
if (algo_ptr.empty()) {
|
if (algo_ptr.empty()) {
|
||||||
@ -551,14 +458,14 @@ inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
|
|||||||
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
|
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> inline
|
||||||
inline void Algorithm::set(const String& _name, const Ptr<_Tp>& value)
|
void Algorithm::set(const String& _name, const Ptr<_Tp>& value)
|
||||||
{
|
{
|
||||||
this->set<_Tp>(_name.c_str(), value);
|
this->set<_Tp>(_name.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> inline
|
||||||
inline void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
|
void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
|
||||||
{
|
{
|
||||||
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
|
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
|
||||||
if (algo_ptr.empty()) {
|
if (algo_ptr.empty()) {
|
||||||
@ -567,44 +474,50 @@ inline void Algorithm::setAlgorithm(const char* _name, const Ptr<_Tp>& value)
|
|||||||
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
|
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp>
|
template<typename _Tp> inline
|
||||||
inline void Algorithm::setAlgorithm(const String& _name, const Ptr<_Tp>& value)
|
void Algorithm::setAlgorithm(const String& _name, const Ptr<_Tp>& value)
|
||||||
{
|
{
|
||||||
this->set<_Tp>(_name.c_str(), value);
|
this->set<_Tp>(_name.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const String& _name) const
|
template<typename _Tp> inline
|
||||||
|
typename ParamType<_Tp>::member_type Algorithm::get(const String& _name) const
|
||||||
{
|
{
|
||||||
typename ParamType<_Tp>::member_type value;
|
typename ParamType<_Tp>::member_type value;
|
||||||
info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value);
|
info()->get(this, _name.c_str(), ParamType<_Tp>::type, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const char* _name) const
|
template<typename _Tp> inline
|
||||||
|
typename ParamType<_Tp>::member_type Algorithm::get(const char* _name) const
|
||||||
{
|
{
|
||||||
typename ParamType<_Tp>::member_type value;
|
typename ParamType<_Tp>::member_type value;
|
||||||
info()->get(this, _name, ParamType<_Tp>::type, &value);
|
info()->get(this, _name, ParamType<_Tp>::type, &value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
template<typename _Tp, typename _Base> inline
|
||||||
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, Ptr<_Tp>& value, bool readOnly,
|
||||||
const String& help)
|
Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
||||||
|
const String& help)
|
||||||
{
|
{
|
||||||
//TODO: static assert: _Tp inherits from _Base
|
//TODO: static assert: _Tp inherits from _Base
|
||||||
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
|
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
|
||||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
|
template<typename _Tp> inline
|
||||||
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter, Ptr<_Tp>& value, bool readOnly,
|
||||||
const String& help)
|
Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
|
||||||
|
const String& help)
|
||||||
{
|
{
|
||||||
//TODO: static assert: _Tp inherits from Algorithm
|
//TODO: static assert: _Tp inherits from Algorithm
|
||||||
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
|
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
|
||||||
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
} // cv
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -226,6 +226,8 @@ public:
|
|||||||
int state; //!< the writer state
|
int state; //!< the writer state
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<> CV_EXPORTS void Ptr<CvFileStorage>::delete_obj();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
File Storage Node class
|
File Storage Node class
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ namespace cv
|
|||||||
#define CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
|
#define CV_TOGGLE_FLT(x) ((x)^((int)(x) < 0 ? 0x7fffffff : 0))
|
||||||
#define CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
|
#define CV_TOGGLE_DBL(x) ((x)^((int64)(x) < 0 ? CV_BIG_INT(0x7fffffffffffffff) : 0))
|
||||||
|
|
||||||
static inline void* cvAlignPtr( const void* ptr, int align CV_DEFAULT(32) )
|
static inline void* cvAlignPtr( const void* ptr, int align = 32 )
|
||||||
{
|
{
|
||||||
CV_DbgAssert ( (align & (align-1)) == 0 );
|
CV_DbgAssert ( (align & (align-1)) == 0 );
|
||||||
return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
|
return (void*)( ((size_t)ptr + align - 1) & ~(size_t)(align-1) );
|
||||||
@ -183,10 +183,12 @@ static inline int cvAlign( int size, int align )
|
|||||||
return (size + align - 1) & -align;
|
return (size + align - 1) & -align;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef IPL_DEPTH_8U
|
||||||
static inline cv::Size cvGetMatSize( const CvMat* mat )
|
static inline cv::Size cvGetMatSize( const CvMat* mat )
|
||||||
{
|
{
|
||||||
return cv::Size(mat->cols, mat->rows);
|
return cv::Size(mat->cols, mat->rows);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<int depth> class TypeDepth {};
|
|
||||||
|
template<int _depth> class TypeDepth
|
||||||
|
{
|
||||||
|
enum { depth = CV_USRTYPE1 };
|
||||||
|
typedef void value_type;
|
||||||
|
};
|
||||||
|
|
||||||
template<> class TypeDepth<CV_8U>
|
template<> class TypeDepth<CV_8U>
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//
|
//
|
||||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||||
|
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
|
||||||
// Third party copyrights are property of their respective owners.
|
// Third party copyrights are property of their respective owners.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,7 @@ namespace
|
|||||||
char buf[32]; // enough for double with precision up to 20
|
char buf[32]; // enough for double with precision up to 20
|
||||||
|
|
||||||
cv::Mat mtx;
|
cv::Mat mtx;
|
||||||
int mcn;
|
int mcn; // == mtx.channels()
|
||||||
bool singleLine;
|
bool singleLine;
|
||||||
|
|
||||||
int state;
|
int state;
|
||||||
@ -68,7 +68,6 @@ namespace
|
|||||||
char braces[5];
|
char braces[5];
|
||||||
|
|
||||||
void (FormattedImpl::*valueToStr)();
|
void (FormattedImpl::*valueToStr)();
|
||||||
|
|
||||||
void valueToStr8u() { sprintf(buf, "%3d", (int)mtx.ptr<uchar>(row, col)[cn]); }
|
void valueToStr8u() { sprintf(buf, "%3d", (int)mtx.ptr<uchar>(row, col)[cn]); }
|
||||||
void valueToStr8s() { sprintf(buf, "%3d", (int)mtx.ptr<schar>(row, col)[cn]); }
|
void valueToStr8s() { sprintf(buf, "%3d", (int)mtx.ptr<schar>(row, col)[cn]); }
|
||||||
void valueToStr16u() { sprintf(buf, "%d", (int)mtx.ptr<ushort>(row, col)[cn]); }
|
void valueToStr16u() { sprintf(buf, "%d", (int)mtx.ptr<ushort>(row, col)[cn]); }
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "test_precomp.hpp"
|
#include "test_precomp.hpp"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -312,9 +312,9 @@ buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Dist
|
|||||||
{
|
{
|
||||||
typedef typename Distance::ElementType ElementType;
|
typedef typename Distance::ElementType ElementType;
|
||||||
if(DataType<ElementType>::type != data.type())
|
if(DataType<ElementType>::type != data.type())
|
||||||
CV_Error_(CV_StsUnsupportedFormat, ("type=%d\n", data.type()));
|
CV_Error_(Error::StsUnsupportedFormat, ("type=%d\n", data.type()));
|
||||||
if(!data.isContinuous())
|
if(!data.isContinuous())
|
||||||
CV_Error(CV_StsBadArg, "Only continuous arrays are supported");
|
CV_Error(Error::StsBadArg, "Only continuous arrays are supported");
|
||||||
|
|
||||||
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
::cvflann::Matrix<ElementType> dataset((ElementType*)data.data, data.rows, data.cols);
|
||||||
IndexType* _index = new IndexType(dataset, get_params(params), dist);
|
IndexType* _index = new IndexType(dataset, get_params(params), dist);
|
||||||
@ -400,7 +400,7 @@ void Index::build(InputArray _data, const IndexParams& params, flann_distance_t
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
CV_Error(CV_StsBadArg, "Unknown/unsupported distance type");
|
CV_Error(Error::StsBadArg, "Unknown/unsupported distance type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,7 +453,7 @@ void Index::release()
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
CV_Error(CV_StsBadArg, "Unknown/unsupported distance type");
|
CV_Error(Error::StsBadArg, "Unknown/unsupported distance type");
|
||||||
}
|
}
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ void Index::knnSearch(InputArray _query, OutputArray _indices,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
CV_Error(CV_StsBadArg, "Unknown/unsupported distance type");
|
CV_Error(Error::StsBadArg, "Unknown/unsupported distance type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ int Index::radiusSearch(InputArray _query, OutputArray _indices,
|
|||||||
createIndicesDists( _indices, _dists, indices, dists, query.rows, maxResults, INT_MAX, dtype );
|
createIndicesDists( _indices, _dists, indices, dists, query.rows, maxResults, INT_MAX, dtype );
|
||||||
|
|
||||||
if( algo == FLANN_INDEX_LSH )
|
if( algo == FLANN_INDEX_LSH )
|
||||||
CV_Error( CV_StsNotImplemented, "LSH index does not support radiusSearch operation" );
|
CV_Error( Error::StsNotImplemented, "LSH index does not support radiusSearch operation" );
|
||||||
|
|
||||||
switch( distType )
|
switch( distType )
|
||||||
{
|
{
|
||||||
@ -623,7 +623,7 @@ int Index::radiusSearch(InputArray _query, OutputArray _indices,
|
|||||||
return runRadiusSearch< ::cvflann::KL_Divergence<float> >(index, query, indices, dists, radius, params);
|
return runRadiusSearch< ::cvflann::KL_Divergence<float> >(index, query, indices, dists, radius, params);
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
CV_Error(CV_StsBadArg, "Unknown/unsupported distance type");
|
CV_Error(Error::StsBadArg, "Unknown/unsupported distance type");
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -658,7 +658,7 @@ void Index::save(const String& filename) const
|
|||||||
{
|
{
|
||||||
FILE* fout = fopen(filename.c_str(), "wb");
|
FILE* fout = fopen(filename.c_str(), "wb");
|
||||||
if (fout == NULL)
|
if (fout == NULL)
|
||||||
CV_Error_( CV_StsError, ("Can not open file %s for writing FLANN index\n", filename.c_str()) );
|
CV_Error_( Error::StsError, ("Can not open file %s for writing FLANN index\n", filename.c_str()) );
|
||||||
|
|
||||||
switch( distType )
|
switch( distType )
|
||||||
{
|
{
|
||||||
@ -691,7 +691,7 @@ void Index::save(const String& filename) const
|
|||||||
default:
|
default:
|
||||||
fclose(fout);
|
fclose(fout);
|
||||||
fout = 0;
|
fout = 0;
|
||||||
CV_Error(CV_StsBadArg, "Unknown/unsupported distance type");
|
CV_Error(Error::StsBadArg, "Unknown/unsupported distance type");
|
||||||
}
|
}
|
||||||
if( fout )
|
if( fout )
|
||||||
fclose(fout);
|
fclose(fout);
|
||||||
|
@ -2543,12 +2543,35 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
|
|||||||
(JNIEnv *env, jclass, jlong self)
|
(JNIEnv *env, jclass, jlong self)
|
||||||
{
|
{
|
||||||
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
cv::Mat* me = (cv::Mat*) self; //TODO: check for NULL
|
||||||
std::stringstream s;
|
|
||||||
try {
|
try {
|
||||||
LOGD("Mat::nDump()");
|
LOGD("Mat::nDump()");
|
||||||
|
|
||||||
s << *me;
|
const int BUFSZ = 4096 - 32;
|
||||||
return env->NewStringUTF(s.str().c_str());
|
char buf[BUFSZ + 32];
|
||||||
|
String s;
|
||||||
|
|
||||||
|
Ptr<Formatted> fmtd = Formatter::get()->format(*me);
|
||||||
|
char* pos = buf;
|
||||||
|
|
||||||
|
for(const char* str = fmtd->next(); str; str = fmtd->next())
|
||||||
|
{
|
||||||
|
pos = strcpy(pos, str);
|
||||||
|
if(pos > buf + BUFSZ)
|
||||||
|
{
|
||||||
|
s = s + String(buf, pos - buf);
|
||||||
|
pos = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos > buf)
|
||||||
|
{
|
||||||
|
if (s.empty())
|
||||||
|
return env->NewStringUTF(buf);
|
||||||
|
|
||||||
|
s = s + String(buf, pos - buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return env->NewStringUTF(s.c_str());
|
||||||
} catch(cv::Exception e) {
|
} catch(cv::Exception e) {
|
||||||
LOGE("Mat::nDump() catched cv::Exception: %s", e.what());
|
LOGE("Mat::nDump() catched cv::Exception: %s", e.what());
|
||||||
jclass je = env->FindClass("org/opencv/core/CvException");
|
jclass je = env->FindClass("org/opencv/core/CvException");
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
|
|
||||||
#include "opencv2/core.hpp"
|
#include "opencv2/core.hpp"
|
||||||
#include "opencv2/core/gpumat.hpp"
|
#include "opencv2/core/gpumat.hpp"
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace cv { namespace softcascade {
|
namespace cv { namespace softcascade {
|
||||||
|
|
||||||
|
@ -165,8 +165,7 @@ void cv::softcascade::write(cv::FileStorage& fs, const cv::String&, const Channe
|
|||||||
|
|
||||||
std::ostream& cv::softcascade::operator<<(std::ostream& out, const ChannelFeature& m)
|
std::ostream& cv::softcascade::operator<<(std::ostream& out, const ChannelFeature& m)
|
||||||
{
|
{
|
||||||
out << m.channel << " " << m.bb;
|
return out << m.channel << " " << "[" << m.bb.width << " x " << m.bb.height << " from (" << m.bb.x << ", " << m.bb.y << ")]";
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelFeature::~ChannelFeature(){}
|
ChannelFeature::~ChannelFeature(){}
|
||||||
|
Loading…
Reference in New Issue
Block a user