Merge remote-tracking branch 'origin/2.4' into merge-2.4
Conflicts: cmake/OpenCVModule.cmake doc/tutorials/calib3d/camera_calibration/camera_calibration.rst doc/tutorials/features2d/feature_detection/feature_detection.rst doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.rst doc/tutorials/features2d/feature_homography/feature_homography.rst modules/core/include/opencv2/core/operations.hpp modules/core/src/arithm.cpp modules/gpu/perf/perf_video.cpp modules/imgproc/include/opencv2/imgproc/imgproc.hpp modules/java/generator/gen_java.py modules/java/generator/src/cpp/VideoCapture.cpp modules/nonfree/src/opencl/surf.cl modules/ocl/include/opencv2/ocl/ocl.hpp modules/ocl/perf/perf_haar.cpp modules/ocl/perf/perf_precomp.hpp modules/ocl/src/color.cpp modules/ocl/src/filtering.cpp modules/ocl/test/test_color.cpp modules/ocl/test/test_objdetect.cpp modules/python/src2/cv2.cpp samples/gpu/CMakeLists.txt samples/gpu/super_resolution.cpp
This commit is contained in:
@@ -49,6 +49,43 @@ Point\_
|
||||
-------
|
||||
.. ocv:class:: Point_
|
||||
|
||||
::
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Point_
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
// various constructors
|
||||
Point_();
|
||||
Point_(_Tp _x, _Tp _y);
|
||||
Point_(const Point_& pt);
|
||||
Point_(const CvPoint& pt);
|
||||
Point_(const CvPoint2D32f& pt);
|
||||
Point_(const Size_<_Tp>& sz);
|
||||
Point_(const Vec<_Tp, 2>& v);
|
||||
|
||||
Point_& operator = (const Point_& pt);
|
||||
//! conversion to another data type
|
||||
template<typename _Tp2> operator Point_<_Tp2>() const;
|
||||
|
||||
//! conversion to the old-style C structures
|
||||
operator CvPoint() const;
|
||||
operator CvPoint2D32f() const;
|
||||
operator Vec<_Tp, 2>() const;
|
||||
|
||||
//! dot product
|
||||
_Tp dot(const Point_& pt) const;
|
||||
//! dot product computed in double-precision arithmetics
|
||||
double ddot(const Point_& pt) const;
|
||||
//! cross-product
|
||||
double cross(const Point_& pt) const;
|
||||
//! checks whether the point is inside the specified rectangle
|
||||
bool inside(const Rect_<_Tp>& r) const;
|
||||
|
||||
_Tp x, y; //< the point coordinates
|
||||
};
|
||||
|
||||
Template class for 2D points specified by its coordinates
|
||||
:math:`x` and
|
||||
:math:`y` .
|
||||
@@ -84,6 +121,39 @@ Point3\_
|
||||
--------
|
||||
.. ocv:class:: Point3_
|
||||
|
||||
::
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Point3_
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
// various constructors
|
||||
Point3_();
|
||||
Point3_(_Tp _x, _Tp _y, _Tp _z);
|
||||
Point3_(const Point3_& pt);
|
||||
explicit Point3_(const Point_<_Tp>& pt);
|
||||
Point3_(const CvPoint3D32f& pt);
|
||||
Point3_(const Vec<_Tp, 3>& v);
|
||||
|
||||
Point3_& operator = (const Point3_& pt);
|
||||
//! conversion to another data type
|
||||
template<typename _Tp2> operator Point3_<_Tp2>() const;
|
||||
//! conversion to the old-style CvPoint...
|
||||
operator CvPoint3D32f() const;
|
||||
//! conversion to cv::Vec<>
|
||||
operator Vec<_Tp, 3>() const;
|
||||
|
||||
//! dot product
|
||||
_Tp dot(const Point3_& pt) const;
|
||||
//! dot product computed in double-precision arithmetics
|
||||
double ddot(const Point3_& pt) const;
|
||||
//! cross product of the 2 3D points
|
||||
Point3_ cross(const Point3_& pt) const;
|
||||
|
||||
_Tp x, y, z; //< the point coordinates
|
||||
};
|
||||
|
||||
Template class for 3D points specified by its coordinates
|
||||
:math:`x`,
|
||||
:math:`y` and
|
||||
@@ -100,6 +170,35 @@ Size\_
|
||||
------
|
||||
.. ocv:class:: Size_
|
||||
|
||||
::
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Size_
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
//! various constructors
|
||||
Size_();
|
||||
Size_(_Tp _width, _Tp _height);
|
||||
Size_(const Size_& sz);
|
||||
Size_(const CvSize& sz);
|
||||
Size_(const CvSize2D32f& sz);
|
||||
Size_(const Point_<_Tp>& pt);
|
||||
|
||||
Size_& operator = (const Size_& sz);
|
||||
//! the area (width*height)
|
||||
_Tp area() const;
|
||||
|
||||
//! conversion of another data type.
|
||||
template<typename _Tp2> operator Size_<_Tp2>() const;
|
||||
|
||||
//! conversion to the old-style OpenCV types
|
||||
operator CvSize() const;
|
||||
operator CvSize2D32f() const;
|
||||
|
||||
_Tp width, height; // the width and the height
|
||||
};
|
||||
|
||||
Template class for specifying the size of an image or rectangle. The class includes two members called ``width`` and ``height``. The structure can be converted to and from the old OpenCV structures
|
||||
``CvSize`` and ``CvSize2D32f`` . The same set of arithmetic and comparison operations as for ``Point_`` is available.
|
||||
|
||||
@@ -113,6 +212,43 @@ Rect\_
|
||||
------
|
||||
.. ocv:class:: Rect_
|
||||
|
||||
::
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Rect_
|
||||
{
|
||||
public:
|
||||
typedef _Tp value_type;
|
||||
|
||||
//! various constructors
|
||||
Rect_();
|
||||
Rect_(_Tp _x, _Tp _y, _Tp _width, _Tp _height);
|
||||
Rect_(const Rect_& r);
|
||||
Rect_(const CvRect& r);
|
||||
Rect_(const Point_<_Tp>& org, const Size_<_Tp>& sz);
|
||||
Rect_(const Point_<_Tp>& pt1, const Point_<_Tp>& pt2);
|
||||
|
||||
Rect_& operator = ( const Rect_& r );
|
||||
//! the top-left corner
|
||||
Point_<_Tp> tl() const;
|
||||
//! the bottom-right corner
|
||||
Point_<_Tp> br() const;
|
||||
|
||||
//! size (width, height) of the rectangle
|
||||
Size_<_Tp> size() const;
|
||||
//! area (width*height) of the rectangle
|
||||
_Tp area() const;
|
||||
|
||||
//! conversion to another data type
|
||||
template<typename _Tp2> operator Rect_<_Tp2>() const;
|
||||
//! conversion to the old-style CvRect
|
||||
operator CvRect() const;
|
||||
|
||||
//! checks whether the rectangle contains the point
|
||||
bool contains(const Point_<_Tp>& pt) const;
|
||||
|
||||
_Tp x, y, width, height; //< the top-left corner, as well as width and height of the rectangle
|
||||
};
|
||||
|
||||
Template class for 2D rectangles, described by the following parameters:
|
||||
|
||||
* Coordinates of the top-left corner. This is a default interpretation of ``Rect_::x`` and ``Rect_::y`` in OpenCV. Though, in your algorithms you may count ``x`` and ``y`` from the bottom-left corner.
|
||||
@@ -171,6 +307,28 @@ RotatedRect
|
||||
-----------
|
||||
.. ocv:class:: RotatedRect
|
||||
|
||||
::
|
||||
|
||||
class CV_EXPORTS RotatedRect
|
||||
{
|
||||
public:
|
||||
//! various constructors
|
||||
RotatedRect();
|
||||
RotatedRect(const Point2f& center, const Size2f& size, float angle);
|
||||
RotatedRect(const CvBox2D& box);
|
||||
|
||||
//! returns 4 vertices of the rectangle
|
||||
void points(Point2f pts[]) const;
|
||||
//! returns the minimal up-right rectangle containing the rotated rectangle
|
||||
Rect boundingRect() const;
|
||||
//! conversion to the old-style CvBox2D structure
|
||||
operator CvBox2D() const;
|
||||
|
||||
Point2f center; //< the rectangle mass center
|
||||
Size2f size; //< width and height of the rectangle
|
||||
float angle; //< the rotation angle. When the angle is 0, 90, 180, 270 etc., the rectangle becomes an up-right rectangle.
|
||||
};
|
||||
|
||||
The class represents rotated (i.e. not up-right) rectangles on a plane. Each rectangle is specified by the center point (mass center), length of each side (represented by cv::Size2f structure) and the rotation angle in degrees.
|
||||
|
||||
.. ocv:function:: RotatedRect::RotatedRect()
|
||||
@@ -217,7 +375,33 @@ TermCriteria
|
||||
------------
|
||||
.. ocv:class:: TermCriteria
|
||||
|
||||
The class defining termination criteria for iterative algorithms. You can initialize it by default constructor and then override any parameters, or the structure may be fully initialized using the advanced variant of the constructor.
|
||||
::
|
||||
|
||||
class CV_EXPORTS TermCriteria
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
COUNT=1, //!< the maximum number of iterations or elements to compute
|
||||
MAX_ITER=COUNT, //!< ditto
|
||||
EPS=2 //!< the desired accuracy or change in parameters at which the iterative algorithm stops
|
||||
};
|
||||
|
||||
//! default constructor
|
||||
TermCriteria();
|
||||
//! full constructor
|
||||
TermCriteria(int type, int maxCount, double epsilon);
|
||||
//! conversion from CvTermCriteria
|
||||
TermCriteria(const CvTermCriteria& criteria);
|
||||
//! conversion to CvTermCriteria
|
||||
operator CvTermCriteria() const;
|
||||
|
||||
int type; //!< the type of termination criteria: COUNT, EPS or COUNT + EPS
|
||||
int maxCount; // the maximum number of iterations/elements
|
||||
double epsilon; // the desired accuracy
|
||||
};
|
||||
|
||||
The class defining termination criteria for iterative algorithms. You can initialize it by default constructor and then override any parameters, or the structure may be fully initialized using the advanced variant of the constructor.
|
||||
|
||||
TermCriteria::TermCriteria
|
||||
--------------------------
|
||||
@@ -321,9 +505,36 @@ Scalar\_
|
||||
--------
|
||||
.. ocv:class:: Scalar_
|
||||
|
||||
Template class for a 4-element vector derived from Vec. ::
|
||||
Template class for a 4-element vector derived from Vec.
|
||||
|
||||
template<typename _Tp> class Scalar_ : public Vec<_Tp, 4> { ... };
|
||||
::
|
||||
|
||||
template<typename _Tp> class CV_EXPORTS Scalar_ : public Vec<_Tp, 4>
|
||||
{
|
||||
public:
|
||||
//! various constructors
|
||||
Scalar_();
|
||||
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
|
||||
Scalar_(const CvScalar& s);
|
||||
Scalar_(_Tp v0);
|
||||
|
||||
//! returns a scalar with all elements set to v0
|
||||
static Scalar_<_Tp> all(_Tp v0);
|
||||
//! conversion to the old-style CvScalar
|
||||
operator CvScalar() const;
|
||||
|
||||
//! conversion to another data type
|
||||
template<typename T2> operator Scalar_<T2>() const;
|
||||
|
||||
//! per-element product
|
||||
Scalar_<_Tp> mul(const Scalar_<_Tp>& t, double scale=1 ) const;
|
||||
|
||||
// returns (v0, -v1, -v2, -v3)
|
||||
Scalar_<_Tp> conj() const;
|
||||
|
||||
// returns true iff v1 == v2 == v3 == 0
|
||||
bool isReal() const;
|
||||
};
|
||||
|
||||
typedef Scalar_<double> Scalar;
|
||||
|
||||
@@ -333,12 +544,21 @@ Range
|
||||
-----
|
||||
.. ocv:class:: Range
|
||||
|
||||
Template class specifying a continuous subsequence (slice) of a sequence. ::
|
||||
Template class specifying a continuous subsequence (slice) of a sequence.
|
||||
|
||||
class Range
|
||||
::
|
||||
|
||||
class CV_EXPORTS Range
|
||||
{
|
||||
public:
|
||||
...
|
||||
Range();
|
||||
Range(int _start, int _end);
|
||||
Range(const CvSlice& slice);
|
||||
int size() const;
|
||||
bool empty() const;
|
||||
static Range all();
|
||||
operator CvSlice() const;
|
||||
|
||||
int start, end;
|
||||
};
|
||||
|
||||
@@ -617,8 +837,8 @@ Ptr::operator ->
|
||||
----------------
|
||||
Provide access to the object fields and methods.
|
||||
|
||||
.. ocv:function:: template<typename _Tp> _Tp* Ptr::operator -> ()
|
||||
.. ocv:function:: template<typename _Tp> const _Tp* Ptr::operator -> () const
|
||||
.. ocv:function:: template<typename _Tp> _Tp* Ptr::operator -> ()
|
||||
.. ocv:function:: template<typename _Tp> const _Tp* Ptr::operator -> () const
|
||||
|
||||
|
||||
Ptr::operator _Tp*
|
||||
@@ -626,15 +846,16 @@ Ptr::operator _Tp*
|
||||
Returns the underlying object pointer. Thanks to the methods, the ``Ptr<_Tp>`` can be used instead
|
||||
of ``_Tp*``.
|
||||
|
||||
.. ocv:function:: template<typename _Tp> Ptr::operator _Tp* ()
|
||||
.. ocv:function:: template<typename _Tp> Ptr::operator const _Tp*() const
|
||||
.. ocv:function:: template<typename _Tp> Ptr::operator _Tp* ()
|
||||
.. ocv:function:: template<typename _Tp> Ptr::operator const _Tp*() const
|
||||
|
||||
|
||||
Mat
|
||||
---
|
||||
.. ocv:class:: Mat
|
||||
|
||||
OpenCV C++ n-dimensional dense array class ::
|
||||
OpenCV C++ n-dimensional dense array class
|
||||
::
|
||||
|
||||
class CV_EXPORTS Mat
|
||||
{
|
||||
@@ -664,7 +885,6 @@ OpenCV C++ n-dimensional dense array class ::
|
||||
...
|
||||
};
|
||||
|
||||
|
||||
The class ``Mat`` represents an n-dimensional dense numerical single-channel or multi-channel array. It can be used to store real or complex-valued vectors and matrices, grayscale or color images, voxel volumes, vector fields, point clouds, tensors, histograms (though, very high-dimensional histograms may be better stored in a ``SparseMat`` ). The data layout of the array
|
||||
:math:`M` is defined by the array ``M.step[]``, so that the address of element
|
||||
:math:`(i_0,...,i_{M.dims-1})`, where
|
||||
@@ -2491,6 +2711,82 @@ Algorithm
|
||||
---------
|
||||
.. ocv:class:: Algorithm
|
||||
|
||||
::
|
||||
|
||||
class CV_EXPORTS_W Algorithm
|
||||
{
|
||||
public:
|
||||
Algorithm();
|
||||
virtual ~Algorithm();
|
||||
string name() const;
|
||||
|
||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const string& name) const;
|
||||
template<typename _Tp> typename ParamType<_Tp>::member_type get(const char* name) const;
|
||||
|
||||
CV_WRAP int getInt(const string& name) const;
|
||||
CV_WRAP double getDouble(const string& name) const;
|
||||
CV_WRAP bool getBool(const string& name) const;
|
||||
CV_WRAP string getString(const string& name) const;
|
||||
CV_WRAP Mat getMat(const string& name) const;
|
||||
CV_WRAP vector<Mat> getMatVector(const string& name) const;
|
||||
CV_WRAP Ptr<Algorithm> getAlgorithm(const string& name) const;
|
||||
|
||||
void set(const string& name, int value);
|
||||
void set(const string& name, double value);
|
||||
void set(const string& name, bool value);
|
||||
void set(const string& name, const string& value);
|
||||
void set(const string& name, const Mat& value);
|
||||
void set(const string& name, const vector<Mat>& value);
|
||||
void set(const string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void set(const string& name, const Ptr<_Tp>& value);
|
||||
|
||||
CV_WRAP void setInt(const string& name, int value);
|
||||
CV_WRAP void setDouble(const string& name, double value);
|
||||
CV_WRAP void setBool(const string& name, bool value);
|
||||
CV_WRAP void setString(const string& name, const string& value);
|
||||
CV_WRAP void setMat(const string& name, const Mat& value);
|
||||
CV_WRAP void setMatVector(const string& name, const vector<Mat>& value);
|
||||
CV_WRAP void setAlgorithm(const string& name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void setAlgorithm(const string& name, const Ptr<_Tp>& value);
|
||||
|
||||
void set(const char* name, int value);
|
||||
void set(const char* name, double value);
|
||||
void set(const char* name, bool value);
|
||||
void set(const char* name, const string& value);
|
||||
void set(const char* name, const Mat& value);
|
||||
void set(const char* name, const vector<Mat>& value);
|
||||
void set(const char* name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void set(const char* name, const Ptr<_Tp>& value);
|
||||
|
||||
void setInt(const char* name, int value);
|
||||
void setDouble(const char* name, double value);
|
||||
void setBool(const char* name, bool value);
|
||||
void setString(const char* name, const string& value);
|
||||
void setMat(const char* name, const Mat& value);
|
||||
void setMatVector(const char* name, const vector<Mat>& value);
|
||||
void setAlgorithm(const char* name, const Ptr<Algorithm>& value);
|
||||
template<typename _Tp> void setAlgorithm(const char* name, const Ptr<_Tp>& value);
|
||||
|
||||
CV_WRAP string paramHelp(const string& name) const;
|
||||
int paramType(const char* name) const;
|
||||
CV_WRAP int paramType(const string& name) const;
|
||||
CV_WRAP void getParams(CV_OUT vector<string>& names) const;
|
||||
|
||||
|
||||
virtual void write(FileStorage& fs) const;
|
||||
virtual void read(const FileNode& fn);
|
||||
|
||||
typedef Algorithm* (*Constructor)(void);
|
||||
typedef int (Algorithm::*Getter)() const;
|
||||
typedef void (Algorithm::*Setter)(int);
|
||||
|
||||
CV_WRAP static void getList(CV_OUT vector<string>& algorithms);
|
||||
CV_WRAP static Ptr<Algorithm> _create(const string& name);
|
||||
template<typename _Tp> static Ptr<_Tp> create(const string& name);
|
||||
|
||||
virtual AlgorithmInfo* info() const /* TODO: make it = 0;*/ { return 0; }
|
||||
};
|
||||
|
||||
This is a base class for all more or less complex algorithms in OpenCV, especially for classes of algorithms, for which there can be multiple implementations. The examples are stereo correspondence (for which there are algorithms like block matching, semi-global block matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck etc.).
|
||||
|
||||
The class provides the following features for all derived classes:
|
||||
|
@@ -406,6 +406,59 @@ CV_EXPORTS void read(const FileNode& node, Mat& mat, const Mat& default_mat = Ma
|
||||
CV_EXPORTS void read(const FileNode& node, SparseMat& mat, const SparseMat& default_mat = SparseMat() );
|
||||
CV_EXPORTS void read(const FileNode& node, std::vector<KeyPoint>& keypoints);
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Point_<_Tp>& value, const Point_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Point_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Point3_<_Tp>& value, const Point3_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 3 ? default_value : Point3_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Size_<_Tp>& value, const Size_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Size_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Complex<_Tp>& value, const Complex<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 2 ? default_value : Complex<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]));
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Rect_<_Tp>& value, const Rect_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 4 ? default_value : Rect_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
|
||||
}
|
||||
|
||||
template<typename _Tp, int cn> static inline void read(const FileNode& node, Vec<_Tp, cn>& value, const Vec<_Tp, cn>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != cn ? default_value : Vec<_Tp, cn>(&temp[0]);
|
||||
}
|
||||
|
||||
template<typename _Tp> static inline void read(const FileNode& node, Scalar_<_Tp>& value, const Scalar_<_Tp>& default_value)
|
||||
{
|
||||
std::vector<_Tp> temp; FileNodeIterator it = node.begin(); it >> temp;
|
||||
value = temp.size() != 4 ? default_value : Scalar_<_Tp>(saturate_cast<_Tp>(temp[0]), saturate_cast<_Tp>(temp[1]),
|
||||
saturate_cast<_Tp>(temp[2]), saturate_cast<_Tp>(temp[3]));
|
||||
}
|
||||
|
||||
static inline void read(const FileNode& node, Range& value, const Range& default_value)
|
||||
{
|
||||
Point2i temp(value.start, value.end); const Point2i default_temp = Point2i(default_value.start, default_value.end);
|
||||
read(node, temp, default_temp);
|
||||
value.start = temp.x; value.end = temp.y;
|
||||
}
|
||||
|
||||
|
||||
CV_EXPORTS FileStorage& operator << (FileStorage& fs, const String& str);
|
||||
|
||||
|
||||
|
@@ -56,6 +56,9 @@
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
|
||||
#define CVAUX_STRW_EXP(__A) L#__A
|
||||
#define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A)
|
||||
|
||||
#if CV_VERSION_REVISION
|
||||
# define CV_VERSION CVAUX_STR(CV_VERSION_EPOCH) "." CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION)
|
||||
#else
|
||||
|
@@ -1 +0,0 @@
|
||||
#include "perf_precomp.hpp"
|
@@ -1131,23 +1131,33 @@ static void binary_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
}
|
||||
}
|
||||
|
||||
static BinaryFunc maxTab[] =
|
||||
static BinaryFunc* getMaxTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(max8u), (BinaryFunc)GET_OPTIMIZED(max8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max16u), (BinaryFunc)GET_OPTIMIZED(max16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32f), (BinaryFunc)max64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc maxTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(max8u), (BinaryFunc)GET_OPTIMIZED(max8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max16u), (BinaryFunc)GET_OPTIMIZED(max16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(max32f), (BinaryFunc)max64f,
|
||||
0
|
||||
};
|
||||
|
||||
static BinaryFunc minTab[] =
|
||||
return maxTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getMinTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(min8u), (BinaryFunc)GET_OPTIMIZED(min8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min16u), (BinaryFunc)GET_OPTIMIZED(min16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32f), (BinaryFunc)min64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc minTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(min8u), (BinaryFunc)GET_OPTIMIZED(min8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min16u), (BinaryFunc)GET_OPTIMIZED(min16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(min32f), (BinaryFunc)min64f,
|
||||
0
|
||||
};
|
||||
|
||||
return minTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1177,24 +1187,24 @@ void cv::bitwise_not(InputArray a, OutputArray c, InputArray mask)
|
||||
|
||||
void cv::max( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
binary_op(src1, src2, dst, noArray(), maxTab, false );
|
||||
binary_op(src1, src2, dst, noArray(), getMaxTab(), false );
|
||||
}
|
||||
|
||||
void cv::min( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
binary_op(src1, src2, dst, noArray(), minTab, false );
|
||||
binary_op(src1, src2, dst, noArray(), getMinTab(), false );
|
||||
}
|
||||
|
||||
void cv::max(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), maxTab, false );
|
||||
binary_op(src1, src2, _dst, noArray(), getMaxTab(), false );
|
||||
}
|
||||
|
||||
void cv::min(const Mat& src1, const Mat& src2, Mat& dst)
|
||||
{
|
||||
OutputArray _dst(dst);
|
||||
binary_op(src1, src2, _dst, noArray(), minTab, false );
|
||||
binary_op(src1, src2, _dst, noArray(), getMinTab(), false );
|
||||
}
|
||||
|
||||
|
||||
@@ -1482,39 +1492,54 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
}
|
||||
}
|
||||
|
||||
static BinaryFunc addTab[] =
|
||||
static BinaryFunc* getAddTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(add8u), (BinaryFunc)GET_OPTIMIZED(add8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add16u), (BinaryFunc)GET_OPTIMIZED(add16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32f), (BinaryFunc)add64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc addTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(add8u), (BinaryFunc)GET_OPTIMIZED(add8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add16u), (BinaryFunc)GET_OPTIMIZED(add16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(add32f), (BinaryFunc)add64f,
|
||||
0
|
||||
};
|
||||
|
||||
static BinaryFunc subTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(sub8u), (BinaryFunc)GET_OPTIMIZED(sub8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub16u), (BinaryFunc)GET_OPTIMIZED(sub16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32f), (BinaryFunc)sub64f,
|
||||
0
|
||||
};
|
||||
return addTab;
|
||||
}
|
||||
|
||||
static BinaryFunc absdiffTab[] =
|
||||
static BinaryFunc* getSubTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff8u), (BinaryFunc)GET_OPTIMIZED(absdiff8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff16u), (BinaryFunc)GET_OPTIMIZED(absdiff16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32f), (BinaryFunc)absdiff64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc subTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(sub8u), (BinaryFunc)GET_OPTIMIZED(sub8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub16u), (BinaryFunc)GET_OPTIMIZED(sub16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(sub32f), (BinaryFunc)sub64f,
|
||||
0
|
||||
};
|
||||
|
||||
return subTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getAbsDiffTab()
|
||||
{
|
||||
static BinaryFunc absDiffTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff8u), (BinaryFunc)GET_OPTIMIZED(absdiff8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff16u), (BinaryFunc)GET_OPTIMIZED(absdiff16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(absdiff32f), (BinaryFunc)absdiff64f,
|
||||
0
|
||||
};
|
||||
|
||||
return absDiffTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cv::add( InputArray src1, InputArray src2, OutputArray dst,
|
||||
InputArray mask, int dtype )
|
||||
{
|
||||
arithm_op(src1, src2, dst, mask, dtype, addTab );
|
||||
arithm_op(src1, src2, dst, mask, dtype, getAddTab() );
|
||||
}
|
||||
|
||||
void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
|
||||
@@ -1549,12 +1574,12 @@ void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
arithm_op(src1, src2, dst, mask, dtype, subTab );
|
||||
arithm_op(src1, src2, dst, mask, dtype, getSubTab() );
|
||||
}
|
||||
|
||||
void cv::absdiff( InputArray src1, InputArray src2, OutputArray dst )
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), -1, absdiffTab);
|
||||
arithm_op(src1, src2, dst, noArray(), -1, getAbsDiffTab());
|
||||
}
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -1844,46 +1869,60 @@ static void recip64f( const double* src1, size_t step1, const double* src2, size
|
||||
}
|
||||
|
||||
|
||||
static BinaryFunc mulTab[] =
|
||||
static BinaryFunc* getMulTab()
|
||||
{
|
||||
(BinaryFunc)mul8u, (BinaryFunc)mul8s, (BinaryFunc)mul16u,
|
||||
(BinaryFunc)mul16s, (BinaryFunc)mul32s, (BinaryFunc)mul32f,
|
||||
(BinaryFunc)mul64f, 0
|
||||
};
|
||||
static BinaryFunc mulTab[] =
|
||||
{
|
||||
(BinaryFunc)mul8u, (BinaryFunc)mul8s, (BinaryFunc)mul16u,
|
||||
(BinaryFunc)mul16s, (BinaryFunc)mul32s, (BinaryFunc)mul32f,
|
||||
(BinaryFunc)mul64f, 0
|
||||
};
|
||||
|
||||
static BinaryFunc divTab[] =
|
||||
return mulTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getDivTab()
|
||||
{
|
||||
(BinaryFunc)div8u, (BinaryFunc)div8s, (BinaryFunc)div16u,
|
||||
(BinaryFunc)div16s, (BinaryFunc)div32s, (BinaryFunc)div32f,
|
||||
(BinaryFunc)div64f, 0
|
||||
};
|
||||
static BinaryFunc divTab[] =
|
||||
{
|
||||
(BinaryFunc)div8u, (BinaryFunc)div8s, (BinaryFunc)div16u,
|
||||
(BinaryFunc)div16s, (BinaryFunc)div32s, (BinaryFunc)div32f,
|
||||
(BinaryFunc)div64f, 0
|
||||
};
|
||||
|
||||
static BinaryFunc recipTab[] =
|
||||
return divTab;
|
||||
}
|
||||
|
||||
static BinaryFunc* getRecipTab()
|
||||
{
|
||||
(BinaryFunc)recip8u, (BinaryFunc)recip8s, (BinaryFunc)recip16u,
|
||||
(BinaryFunc)recip16s, (BinaryFunc)recip32s, (BinaryFunc)recip32f,
|
||||
(BinaryFunc)recip64f, 0
|
||||
};
|
||||
static BinaryFunc recipTab[] =
|
||||
{
|
||||
(BinaryFunc)recip8u, (BinaryFunc)recip8s, (BinaryFunc)recip16u,
|
||||
(BinaryFunc)recip16s, (BinaryFunc)recip32s, (BinaryFunc)recip32f,
|
||||
(BinaryFunc)recip64f, 0
|
||||
};
|
||||
|
||||
return recipTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cv::multiply(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, mulTab, true, &scale);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getMulTab(), true, &scale);
|
||||
}
|
||||
|
||||
void cv::divide(InputArray src1, InputArray src2,
|
||||
OutputArray dst, double scale, int dtype)
|
||||
{
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, divTab, true, &scale);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getDivTab(), true, &scale);
|
||||
}
|
||||
|
||||
void cv::divide(double scale, InputArray src2,
|
||||
OutputArray dst, int dtype)
|
||||
{
|
||||
arithm_op(src2, src2, dst, noArray(), dtype, recipTab, true, &scale);
|
||||
arithm_op(src2, src2, dst, noArray(), dtype, getRecipTab(), true, &scale);
|
||||
}
|
||||
|
||||
/****************************************************************************************\
|
||||
@@ -2026,12 +2065,17 @@ static void addWeighted64f( const double* src1, size_t step1, const double* src2
|
||||
addWeighted_<double, double>(src1, step1, src2, step2, dst, step, sz, scalars);
|
||||
}
|
||||
|
||||
static BinaryFunc addWeightedTab[] =
|
||||
static BinaryFunc* getAddWeightedTab()
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f,
|
||||
(BinaryFunc)addWeighted64f, 0
|
||||
};
|
||||
static BinaryFunc addWeightedTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted8u), (BinaryFunc)GET_OPTIMIZED(addWeighted8s), (BinaryFunc)GET_OPTIMIZED(addWeighted16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(addWeighted16s), (BinaryFunc)GET_OPTIMIZED(addWeighted32s), (BinaryFunc)addWeighted32f,
|
||||
(BinaryFunc)addWeighted64f, 0
|
||||
};
|
||||
|
||||
return addWeightedTab;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2039,7 +2083,7 @@ void cv::addWeighted( InputArray src1, double alpha, InputArray src2,
|
||||
double beta, double gamma, OutputArray dst, int dtype )
|
||||
{
|
||||
double scalars[] = {alpha, beta, gamma};
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, addWeightedTab, true, scalars);
|
||||
arithm_op(src1, src2, dst, noArray(), dtype, getAddWeightedTab(), true, scalars);
|
||||
}
|
||||
|
||||
|
||||
@@ -2299,15 +2343,19 @@ static void cmp64f(const double* src1, size_t step1, const double* src2, size_t
|
||||
cmp_(src1, step1, src2, step2, dst, step, size, *(int*)_cmpop);
|
||||
}
|
||||
|
||||
static BinaryFunc cmpTab[] =
|
||||
static BinaryFunc getCmpFunc(int depth)
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp8u), (BinaryFunc)GET_OPTIMIZED(cmp8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp16u), (BinaryFunc)GET_OPTIMIZED(cmp16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32f), (BinaryFunc)cmp64f,
|
||||
0
|
||||
};
|
||||
static BinaryFunc cmpTab[] =
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp8u), (BinaryFunc)GET_OPTIMIZED(cmp8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp16u), (BinaryFunc)GET_OPTIMIZED(cmp16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cmp32f), (BinaryFunc)cmp64f,
|
||||
0
|
||||
};
|
||||
|
||||
return cmpTab[depth];
|
||||
}
|
||||
|
||||
static double getMinVal(int depth)
|
||||
{
|
||||
@@ -2337,7 +2385,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
_dst.create(src1.size(), CV_8UC(cn));
|
||||
Mat dst = _dst.getMat();
|
||||
Size sz = getContinuousSize(src1, src2, dst, src1.channels());
|
||||
cmpTab[src1.depth()](src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, &op);
|
||||
getCmpFunc(src1.depth())(src1.data, src1.step, src2.data, src2.step, dst.data, dst.step, sz, &op);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2369,7 +2417,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
|
||||
|
||||
size_t esz = src1.elemSize();
|
||||
size_t blocksize0 = (size_t)(BLOCK_SIZE + esz-1)/esz;
|
||||
BinaryFunc func = cmpTab[depth1];
|
||||
BinaryFunc func = getCmpFunc(depth1);
|
||||
|
||||
if( !haveScalar )
|
||||
{
|
||||
@@ -2546,12 +2594,17 @@ static void inRangeReduce(const uchar* src, uchar* dst, size_t len, int cn)
|
||||
typedef void (*InRangeFunc)( const uchar* src1, size_t step1, const uchar* src2, size_t step2,
|
||||
const uchar* src3, size_t step3, uchar* dst, size_t step, Size sz );
|
||||
|
||||
static InRangeFunc inRangeTab[] =
|
||||
static InRangeFunc getInRangeFunc(int depth)
|
||||
{
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u),
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f),
|
||||
(InRangeFunc)inRange64f, 0
|
||||
};
|
||||
static InRangeFunc inRangeTab[] =
|
||||
{
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange8u), (InRangeFunc)GET_OPTIMIZED(inRange8s), (InRangeFunc)GET_OPTIMIZED(inRange16u),
|
||||
(InRangeFunc)GET_OPTIMIZED(inRange16s), (InRangeFunc)GET_OPTIMIZED(inRange32s), (InRangeFunc)GET_OPTIMIZED(inRange32f),
|
||||
(InRangeFunc)inRange64f, 0
|
||||
};
|
||||
|
||||
return inRangeTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2590,7 +2643,7 @@ void cv::inRange(InputArray _src, InputArray _lowerb,
|
||||
|
||||
_dst.create(src.dims, src.size, CV_8U);
|
||||
Mat dst = _dst.getMat();
|
||||
InRangeFunc func = inRangeTab[depth];
|
||||
InRangeFunc func = getInRangeFunc(depth);
|
||||
|
||||
const Mat* arrays_sc[] = { &src, &dst, 0 };
|
||||
const Mat* arrays_nosc[] = { &src, &dst, &lb, &ub, 0 };
|
||||
|
@@ -194,17 +194,27 @@ static void merge64s(const int64** src, int64* dst, int len, int cn )
|
||||
typedef void (*SplitFunc)(const uchar* src, uchar** dst, int len, int cn);
|
||||
typedef void (*MergeFunc)(const uchar** src, uchar* dst, int len, int cn);
|
||||
|
||||
static SplitFunc splitTab[] =
|
||||
static SplitFunc getSplitFunc(int depth)
|
||||
{
|
||||
(SplitFunc)GET_OPTIMIZED(split8u), (SplitFunc)GET_OPTIMIZED(split8u), (SplitFunc)GET_OPTIMIZED(split16u), (SplitFunc)GET_OPTIMIZED(split16u),
|
||||
(SplitFunc)GET_OPTIMIZED(split32s), (SplitFunc)GET_OPTIMIZED(split32s), (SplitFunc)GET_OPTIMIZED(split64s), 0
|
||||
};
|
||||
static SplitFunc splitTab[] =
|
||||
{
|
||||
(SplitFunc)GET_OPTIMIZED(split8u), (SplitFunc)GET_OPTIMIZED(split8u), (SplitFunc)GET_OPTIMIZED(split16u), (SplitFunc)GET_OPTIMIZED(split16u),
|
||||
(SplitFunc)GET_OPTIMIZED(split32s), (SplitFunc)GET_OPTIMIZED(split32s), (SplitFunc)GET_OPTIMIZED(split64s), 0
|
||||
};
|
||||
|
||||
static MergeFunc mergeTab[] =
|
||||
return splitTab[depth];
|
||||
}
|
||||
|
||||
static MergeFunc getMergeFunc(int depth)
|
||||
{
|
||||
(MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge16u), (MergeFunc)GET_OPTIMIZED(merge16u),
|
||||
(MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge64s), 0
|
||||
};
|
||||
static MergeFunc mergeTab[] =
|
||||
{
|
||||
(MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge8u), (MergeFunc)GET_OPTIMIZED(merge16u), (MergeFunc)GET_OPTIMIZED(merge16u),
|
||||
(MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge32s), (MergeFunc)GET_OPTIMIZED(merge64s), 0
|
||||
};
|
||||
|
||||
return mergeTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -217,7 +227,7 @@ void cv::split(const Mat& src, Mat* mv)
|
||||
return;
|
||||
}
|
||||
|
||||
SplitFunc func = splitTab[depth];
|
||||
SplitFunc func = getSplitFunc(depth);
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
int esz = (int)src.elemSize(), esz1 = (int)src.elemSize1();
|
||||
@@ -323,7 +333,7 @@ void cv::merge(const Mat* mv, size_t n, OutputArray _dst)
|
||||
|
||||
NAryMatIterator it(arrays, ptrs, cn+1);
|
||||
int total = (int)it.size, blocksize = cn <= 4 ? total : std::min(total, blocksize0);
|
||||
MergeFunc func = mergeTab[depth];
|
||||
MergeFunc func = getMergeFunc(depth);
|
||||
|
||||
for( i = 0; i < it.nplanes; i++, ++it )
|
||||
{
|
||||
@@ -419,12 +429,17 @@ static void mixChannels64s( const int64** src, const int* sdelta,
|
||||
typedef void (*MixChannelsFunc)( const uchar** src, const int* sdelta,
|
||||
uchar** dst, const int* ddelta, int len, int npairs );
|
||||
|
||||
static MixChannelsFunc mixchTab[] =
|
||||
static MixChannelsFunc getMixchFunc(int depth)
|
||||
{
|
||||
(MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels16u,
|
||||
(MixChannelsFunc)mixChannels16u, (MixChannelsFunc)mixChannels32s, (MixChannelsFunc)mixChannels32s,
|
||||
(MixChannelsFunc)mixChannels64s, 0
|
||||
};
|
||||
static MixChannelsFunc mixchTab[] =
|
||||
{
|
||||
(MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels8u, (MixChannelsFunc)mixChannels16u,
|
||||
(MixChannelsFunc)mixChannels16u, (MixChannelsFunc)mixChannels32s, (MixChannelsFunc)mixChannels32s,
|
||||
(MixChannelsFunc)mixChannels64s, 0
|
||||
};
|
||||
|
||||
return mixchTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -479,7 +494,7 @@ void cv::mixChannels( const Mat* src, size_t nsrcs, Mat* dst, size_t ndsts, cons
|
||||
|
||||
NAryMatIterator it(arrays, ptrs, (int)(nsrcs + ndsts));
|
||||
int total = (int)it.size, blocksize = std::min(total, (int)((BLOCK_SIZE + esz1-1)/esz1));
|
||||
MixChannelsFunc func = mixchTab[depth];
|
||||
MixChannelsFunc func = getMixchFunc(depth);
|
||||
|
||||
for( i = 0; i < it.nplanes; i++, ++it )
|
||||
{
|
||||
@@ -947,104 +962,109 @@ DEF_CVT_FUNC(32s64f, int, double);
|
||||
DEF_CVT_FUNC(32f64f, float, double);
|
||||
DEF_CPY_FUNC(64s, int64);
|
||||
|
||||
static BinaryFunc cvtScaleAbsTab[] =
|
||||
static BinaryFunc getCvtScaleAbsFunc(int depth)
|
||||
{
|
||||
(BinaryFunc)cvtScaleAbs8u, (BinaryFunc)cvtScaleAbs8s8u, (BinaryFunc)cvtScaleAbs16u8u,
|
||||
(BinaryFunc)cvtScaleAbs16s8u, (BinaryFunc)cvtScaleAbs32s8u, (BinaryFunc)cvtScaleAbs32f8u,
|
||||
(BinaryFunc)cvtScaleAbs64f8u, 0
|
||||
};
|
||||
static BinaryFunc cvtScaleAbsTab[] =
|
||||
{
|
||||
(BinaryFunc)cvtScaleAbs8u, (BinaryFunc)cvtScaleAbs8s8u, (BinaryFunc)cvtScaleAbs16u8u,
|
||||
(BinaryFunc)cvtScaleAbs16s8u, (BinaryFunc)cvtScaleAbs32s8u, (BinaryFunc)cvtScaleAbs32f8u,
|
||||
(BinaryFunc)cvtScaleAbs64f8u, 0
|
||||
};
|
||||
|
||||
static BinaryFunc cvtScaleTab[][8] =
|
||||
{
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8u),
|
||||
(BinaryFunc)cvtScale64f8u, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u8s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8s),
|
||||
(BinaryFunc)cvtScale64f8s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u16u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16u),
|
||||
(BinaryFunc)cvtScale64f16u, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u16s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16s),
|
||||
(BinaryFunc)cvtScale64f16s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u32s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f32s),
|
||||
(BinaryFunc)cvtScale64f32s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u32f), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32f),
|
||||
(BinaryFunc)cvtScale64f32f, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)cvtScale8u64f, (BinaryFunc)cvtScale8s64f, (BinaryFunc)cvtScale16u64f,
|
||||
(BinaryFunc)cvtScale16s64f, (BinaryFunc)cvtScale32s64f, (BinaryFunc)cvtScale32f64f,
|
||||
(BinaryFunc)cvtScale64f, 0
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
static BinaryFunc cvtTab[][8] =
|
||||
{
|
||||
{
|
||||
(BinaryFunc)(cvt8u), (BinaryFunc)GET_OPTIMIZED(cvt8s8u), (BinaryFunc)GET_OPTIMIZED(cvt16u8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s8u), (BinaryFunc)GET_OPTIMIZED(cvt32s8u), (BinaryFunc)GET_OPTIMIZED(cvt32f8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f8u), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u8s), (BinaryFunc)cvt8u, (BinaryFunc)GET_OPTIMIZED(cvt16u8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s8s), (BinaryFunc)GET_OPTIMIZED(cvt32s8s), (BinaryFunc)GET_OPTIMIZED(cvt32f8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f8s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u16u), (BinaryFunc)GET_OPTIMIZED(cvt8s16u), (BinaryFunc)cvt16u,
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s16u), (BinaryFunc)GET_OPTIMIZED(cvt32s16u), (BinaryFunc)GET_OPTIMIZED(cvt32f16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f16u), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u16s), (BinaryFunc)GET_OPTIMIZED(cvt8s16s), (BinaryFunc)GET_OPTIMIZED(cvt16u16s),
|
||||
(BinaryFunc)cvt16u, (BinaryFunc)GET_OPTIMIZED(cvt32s16s), (BinaryFunc)GET_OPTIMIZED(cvt32f16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f16s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u32s), (BinaryFunc)GET_OPTIMIZED(cvt8s32s), (BinaryFunc)GET_OPTIMIZED(cvt16u32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s32s), (BinaryFunc)cvt32s, (BinaryFunc)GET_OPTIMIZED(cvt32f32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f32s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u32f), (BinaryFunc)GET_OPTIMIZED(cvt8s32f), (BinaryFunc)GET_OPTIMIZED(cvt16u32f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s32f), (BinaryFunc)GET_OPTIMIZED(cvt32s32f), (BinaryFunc)cvt32s,
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f32f), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u64f), (BinaryFunc)GET_OPTIMIZED(cvt8s64f), (BinaryFunc)GET_OPTIMIZED(cvt16u64f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s64f), (BinaryFunc)GET_OPTIMIZED(cvt32s64f), (BinaryFunc)GET_OPTIMIZED(cvt32f64f),
|
||||
(BinaryFunc)(cvt64s), 0
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
return cvtScaleAbsTab[depth];
|
||||
}
|
||||
|
||||
BinaryFunc getConvertFunc(int sdepth, int ddepth)
|
||||
{
|
||||
static BinaryFunc cvtTab[][8] =
|
||||
{
|
||||
{
|
||||
(BinaryFunc)(cvt8u), (BinaryFunc)GET_OPTIMIZED(cvt8s8u), (BinaryFunc)GET_OPTIMIZED(cvt16u8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s8u), (BinaryFunc)GET_OPTIMIZED(cvt32s8u), (BinaryFunc)GET_OPTIMIZED(cvt32f8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f8u), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u8s), (BinaryFunc)cvt8u, (BinaryFunc)GET_OPTIMIZED(cvt16u8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s8s), (BinaryFunc)GET_OPTIMIZED(cvt32s8s), (BinaryFunc)GET_OPTIMIZED(cvt32f8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f8s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u16u), (BinaryFunc)GET_OPTIMIZED(cvt8s16u), (BinaryFunc)cvt16u,
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s16u), (BinaryFunc)GET_OPTIMIZED(cvt32s16u), (BinaryFunc)GET_OPTIMIZED(cvt32f16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f16u), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u16s), (BinaryFunc)GET_OPTIMIZED(cvt8s16s), (BinaryFunc)GET_OPTIMIZED(cvt16u16s),
|
||||
(BinaryFunc)cvt16u, (BinaryFunc)GET_OPTIMIZED(cvt32s16s), (BinaryFunc)GET_OPTIMIZED(cvt32f16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f16s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u32s), (BinaryFunc)GET_OPTIMIZED(cvt8s32s), (BinaryFunc)GET_OPTIMIZED(cvt16u32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s32s), (BinaryFunc)cvt32s, (BinaryFunc)GET_OPTIMIZED(cvt32f32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f32s), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u32f), (BinaryFunc)GET_OPTIMIZED(cvt8s32f), (BinaryFunc)GET_OPTIMIZED(cvt16u32f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s32f), (BinaryFunc)GET_OPTIMIZED(cvt32s32f), (BinaryFunc)cvt32s,
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt64f32f), 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt8u64f), (BinaryFunc)GET_OPTIMIZED(cvt8s64f), (BinaryFunc)GET_OPTIMIZED(cvt16u64f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvt16s64f), (BinaryFunc)GET_OPTIMIZED(cvt32s64f), (BinaryFunc)GET_OPTIMIZED(cvt32f64f),
|
||||
(BinaryFunc)(cvt64s), 0
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
return cvtTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
|
||||
}
|
||||
|
||||
static BinaryFunc getConvertScaleFunc(int sdepth, int ddepth)
|
||||
{
|
||||
static BinaryFunc cvtScaleTab[][8] =
|
||||
{
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8u),
|
||||
(BinaryFunc)cvtScale64f8u, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u8s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u8s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s8s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f8s),
|
||||
(BinaryFunc)cvtScale64f8s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u16u), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale16u),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16u), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16u),
|
||||
(BinaryFunc)cvtScale64f16u, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u16s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u16s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s16s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f16s),
|
||||
(BinaryFunc)cvtScale64f16s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u32s), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32s),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32s), (BinaryFunc)GET_OPTIMIZED(cvtScale32f32s),
|
||||
(BinaryFunc)cvtScale64f32s, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale8u32f), (BinaryFunc)GET_OPTIMIZED(cvtScale8s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale16u32f),
|
||||
(BinaryFunc)GET_OPTIMIZED(cvtScale16s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32s32f), (BinaryFunc)GET_OPTIMIZED(cvtScale32f),
|
||||
(BinaryFunc)cvtScale64f32f, 0
|
||||
},
|
||||
{
|
||||
(BinaryFunc)cvtScale8u64f, (BinaryFunc)cvtScale8s64f, (BinaryFunc)cvtScale16u64f,
|
||||
(BinaryFunc)cvtScale16s64f, (BinaryFunc)cvtScale32s64f, (BinaryFunc)cvtScale32f64f,
|
||||
(BinaryFunc)cvtScale64f, 0
|
||||
},
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
}
|
||||
};
|
||||
|
||||
return cvtScaleTab[CV_MAT_DEPTH(ddepth)][CV_MAT_DEPTH(sdepth)];
|
||||
}
|
||||
|
||||
@@ -1057,7 +1077,7 @@ void cv::convertScaleAbs( InputArray _src, OutputArray _dst, double alpha, doubl
|
||||
double scale[] = {alpha, beta};
|
||||
_dst.create( src.dims, src.size, CV_8UC(cn) );
|
||||
Mat dst = _dst.getMat();
|
||||
BinaryFunc func = cvtScaleAbsTab[src.depth()];
|
||||
BinaryFunc func = getCvtScaleAbsFunc(src.depth());
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
if( src.dims <= 2 )
|
||||
|
@@ -1725,19 +1725,29 @@ diagtransform_64f(const double* src, double* dst, const double* m, int len, int
|
||||
|
||||
typedef void (*TransformFunc)( const uchar* src, uchar* dst, const uchar* m, int, int, int );
|
||||
|
||||
static TransformFunc transformTab[] =
|
||||
static TransformFunc getTransformFunc(int depth)
|
||||
{
|
||||
(TransformFunc)transform_8u, (TransformFunc)transform_8s, (TransformFunc)transform_16u,
|
||||
(TransformFunc)transform_16s, (TransformFunc)transform_32s, (TransformFunc)transform_32f,
|
||||
(TransformFunc)transform_64f, 0
|
||||
};
|
||||
static TransformFunc transformTab[] =
|
||||
{
|
||||
(TransformFunc)transform_8u, (TransformFunc)transform_8s, (TransformFunc)transform_16u,
|
||||
(TransformFunc)transform_16s, (TransformFunc)transform_32s, (TransformFunc)transform_32f,
|
||||
(TransformFunc)transform_64f, 0
|
||||
};
|
||||
|
||||
static TransformFunc diagTransformTab[] =
|
||||
return transformTab[depth];
|
||||
}
|
||||
|
||||
static TransformFunc getDiagTransformFunc(int depth)
|
||||
{
|
||||
(TransformFunc)diagtransform_8u, (TransformFunc)diagtransform_8s, (TransformFunc)diagtransform_16u,
|
||||
(TransformFunc)diagtransform_16s, (TransformFunc)diagtransform_32s, (TransformFunc)diagtransform_32f,
|
||||
(TransformFunc)diagtransform_64f, 0
|
||||
};
|
||||
static TransformFunc diagTransformTab[] =
|
||||
{
|
||||
(TransformFunc)diagtransform_8u, (TransformFunc)diagtransform_8s, (TransformFunc)diagtransform_16u,
|
||||
(TransformFunc)diagtransform_16s, (TransformFunc)diagtransform_32s, (TransformFunc)diagtransform_32f,
|
||||
(TransformFunc)diagtransform_64f, 0
|
||||
};
|
||||
|
||||
return diagTransformTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1800,7 +1810,7 @@ void cv::transform( InputArray _src, OutputArray _dst, InputArray _mtx )
|
||||
}
|
||||
}
|
||||
|
||||
TransformFunc func = isDiag ? diagTransformTab[depth] : transformTab[depth];
|
||||
TransformFunc func = isDiag ? getDiagTransformFunc(depth): getTransformFunc(depth);
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
const Mat* arrays[] = {&src, &dst, 0};
|
||||
@@ -2761,19 +2771,24 @@ static double dotProd_64f(const double* src1, const double* src2, int len)
|
||||
|
||||
typedef double (*DotProdFunc)(const uchar* src1, const uchar* src2, int len);
|
||||
|
||||
static DotProdFunc dotProdTab[] =
|
||||
static DotProdFunc getDotProdFunc(int depth)
|
||||
{
|
||||
(DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)GET_OPTIMIZED(dotProd_8s),
|
||||
(DotProdFunc)dotProd_16u, (DotProdFunc)dotProd_16s,
|
||||
(DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f),
|
||||
(DotProdFunc)dotProd_64f, 0
|
||||
};
|
||||
static DotProdFunc dotProdTab[] =
|
||||
{
|
||||
(DotProdFunc)GET_OPTIMIZED(dotProd_8u), (DotProdFunc)GET_OPTIMIZED(dotProd_8s),
|
||||
(DotProdFunc)dotProd_16u, (DotProdFunc)dotProd_16s,
|
||||
(DotProdFunc)dotProd_32s, (DotProdFunc)GET_OPTIMIZED(dotProd_32f),
|
||||
(DotProdFunc)dotProd_64f, 0
|
||||
};
|
||||
|
||||
return dotProdTab[depth];
|
||||
}
|
||||
|
||||
double Mat::dot(InputArray _mat) const
|
||||
{
|
||||
Mat mat = _mat.getMat();
|
||||
int cn = channels();
|
||||
DotProdFunc func = dotProdTab[depth()];
|
||||
DotProdFunc func = getDotProdFunc(depth());
|
||||
CV_Assert( mat.type() == type() && mat.size == size && func != 0 );
|
||||
|
||||
if( isContinuous() && mat.isContinuous() )
|
||||
|
@@ -1,45 +0,0 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
/* End of file. */
|
@@ -200,14 +200,19 @@ static int sum64f( const double* src, const uchar* mask, double* dst, int len, i
|
||||
|
||||
typedef int (*SumFunc)(const uchar*, const uchar* mask, uchar*, int, int);
|
||||
|
||||
static SumFunc sumTab[] =
|
||||
static SumFunc getSumFunc(int depth)
|
||||
{
|
||||
(SumFunc)GET_OPTIMIZED(sum8u), (SumFunc)sum8s,
|
||||
(SumFunc)sum16u, (SumFunc)sum16s,
|
||||
(SumFunc)sum32s,
|
||||
(SumFunc)GET_OPTIMIZED(sum32f), (SumFunc)sum64f,
|
||||
0
|
||||
};
|
||||
static SumFunc sumTab[] =
|
||||
{
|
||||
(SumFunc)GET_OPTIMIZED(sum8u), (SumFunc)sum8s,
|
||||
(SumFunc)sum16u, (SumFunc)sum16s,
|
||||
(SumFunc)sum32s,
|
||||
(SumFunc)GET_OPTIMIZED(sum32f), (SumFunc)sum64f,
|
||||
0
|
||||
};
|
||||
|
||||
return sumTab[depth];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static int countNonZero_(const T* src, int len )
|
||||
@@ -272,14 +277,18 @@ static int countNonZero64f( const double* src, int len )
|
||||
|
||||
typedef int (*CountNonZeroFunc)(const uchar*, int);
|
||||
|
||||
static CountNonZeroFunc countNonZeroTab[] =
|
||||
static CountNonZeroFunc getCountNonZeroTab(int depth)
|
||||
{
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero32s), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero32f),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero64f), 0
|
||||
};
|
||||
static CountNonZeroFunc countNonZeroTab[] =
|
||||
{
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero8u),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero16u),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero32s), (CountNonZeroFunc)GET_OPTIMIZED(countNonZero32f),
|
||||
(CountNonZeroFunc)GET_OPTIMIZED(countNonZero64f), 0
|
||||
};
|
||||
|
||||
return countNonZeroTab[depth];
|
||||
}
|
||||
|
||||
template<typename T, typename ST, typename SQT>
|
||||
static int sumsqr_(const T* src0, const uchar* mask, ST* sum, SQT* sqsum, int len, int cn )
|
||||
@@ -428,11 +437,16 @@ static int sqsum64f( const double* src, const uchar* mask, double* sum, double*
|
||||
|
||||
typedef int (*SumSqrFunc)(const uchar*, const uchar* mask, uchar*, uchar*, int, int);
|
||||
|
||||
static SumSqrFunc sumSqrTab[] =
|
||||
static SumSqrFunc getSumSqrTab(int depth)
|
||||
{
|
||||
(SumSqrFunc)GET_OPTIMIZED(sqsum8u), (SumSqrFunc)sqsum8s, (SumSqrFunc)sqsum16u, (SumSqrFunc)sqsum16s,
|
||||
(SumSqrFunc)sqsum32s, (SumSqrFunc)GET_OPTIMIZED(sqsum32f), (SumSqrFunc)sqsum64f, 0
|
||||
};
|
||||
static SumSqrFunc sumSqrTab[] =
|
||||
{
|
||||
(SumSqrFunc)GET_OPTIMIZED(sqsum8u), (SumSqrFunc)sqsum8s, (SumSqrFunc)sqsum16u, (SumSqrFunc)sqsum16s,
|
||||
(SumSqrFunc)sqsum32s, (SumSqrFunc)GET_OPTIMIZED(sqsum32f), (SumSqrFunc)sqsum64f, 0
|
||||
};
|
||||
|
||||
return sumSqrTab[depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -479,7 +493,7 @@ cv::Scalar cv::sum( InputArray _src )
|
||||
}
|
||||
#endif
|
||||
|
||||
SumFunc func = sumTab[depth];
|
||||
SumFunc func = getSumFunc(depth);
|
||||
|
||||
CV_Assert( cn <= 4 && func != 0 );
|
||||
|
||||
@@ -531,7 +545,7 @@ cv::Scalar cv::sum( InputArray _src )
|
||||
int cv::countNonZero( InputArray _src )
|
||||
{
|
||||
Mat src = _src.getMat();
|
||||
CountNonZeroFunc func = countNonZeroTab[src.depth()];
|
||||
CountNonZeroFunc func = getCountNonZeroTab(src.depth());
|
||||
|
||||
CV_Assert( src.channels() == 1 && func != 0 );
|
||||
|
||||
@@ -627,7 +641,7 @@ cv::Scalar cv::mean( InputArray _src, InputArray _mask )
|
||||
}
|
||||
#endif
|
||||
|
||||
SumFunc func = sumTab[depth];
|
||||
SumFunc func = getSumFunc(depth);
|
||||
|
||||
CV_Assert( cn <= 4 && func != 0 );
|
||||
|
||||
@@ -686,7 +700,7 @@ void cv::meanStdDev( InputArray _src, OutputArray _mean, OutputArray _sdv, Input
|
||||
CV_Assert( mask.empty() || mask.type() == CV_8U );
|
||||
|
||||
int k, cn = src.channels(), depth = src.depth();
|
||||
SumSqrFunc func = sumSqrTab[depth];
|
||||
SumSqrFunc func = getSumSqrTab(depth);
|
||||
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
@@ -860,14 +874,19 @@ static void minMaxIdx_64f(const double* src, const uchar* mask, double* minval,
|
||||
|
||||
typedef void (*MinMaxIdxFunc)(const uchar*, const uchar*, int*, int*, size_t*, size_t*, int, size_t);
|
||||
|
||||
static MinMaxIdxFunc minmaxTab[] =
|
||||
static MinMaxIdxFunc getMinmaxTab(int depth)
|
||||
{
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32f), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_64f),
|
||||
0
|
||||
};
|
||||
static MinMaxIdxFunc minmaxTab[] =
|
||||
{
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_8s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16u), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_16s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32s),
|
||||
(MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_32f), (MinMaxIdxFunc)GET_OPTIMIZED(minMaxIdx_64f),
|
||||
0
|
||||
};
|
||||
|
||||
return minmaxTab[depth];
|
||||
}
|
||||
|
||||
static void ofs2idx(const Mat& a, size_t ofs, int* idx)
|
||||
{
|
||||
@@ -900,7 +919,7 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
|
||||
|
||||
CV_Assert( (cn == 1 && (mask.empty() || mask.type() == CV_8U)) ||
|
||||
(cn >= 1 && mask.empty() && !minIdx && !maxIdx) );
|
||||
MinMaxIdxFunc func = minmaxTab[depth];
|
||||
MinMaxIdxFunc func = getMinmaxTab(depth);
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
const Mat* arrays[] = {&src, &mask, 0};
|
||||
@@ -1365,43 +1384,53 @@ CV_DEF_NORM_ALL(64f, double, double, double, double)
|
||||
typedef int (*NormFunc)(const uchar*, const uchar*, uchar*, int, int);
|
||||
typedef int (*NormDiffFunc)(const uchar*, const uchar*, const uchar*, uchar*, int, int);
|
||||
|
||||
static NormFunc normTab[3][8] =
|
||||
static NormFunc getNormFunc(int normType, int depth)
|
||||
{
|
||||
static NormFunc normTab[3][8] =
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)GET_OPTIMIZED(normInf_8s), (NormFunc)GET_OPTIMIZED(normInf_16u), (NormFunc)GET_OPTIMIZED(normInf_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normInf_32s), (NormFunc)GET_OPTIMIZED(normInf_32f), (NormFunc)normInf_64f, 0
|
||||
},
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normL1_8u), (NormFunc)GET_OPTIMIZED(normL1_8s), (NormFunc)GET_OPTIMIZED(normL1_16u), (NormFunc)GET_OPTIMIZED(normL1_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normL1_32s), (NormFunc)GET_OPTIMIZED(normL1_32f), (NormFunc)normL1_64f, 0
|
||||
},
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normL2_8u), (NormFunc)GET_OPTIMIZED(normL2_8s), (NormFunc)GET_OPTIMIZED(normL2_16u), (NormFunc)GET_OPTIMIZED(normL2_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normL2_32s), (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0
|
||||
}
|
||||
};
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normInf_8u), (NormFunc)GET_OPTIMIZED(normInf_8s), (NormFunc)GET_OPTIMIZED(normInf_16u), (NormFunc)GET_OPTIMIZED(normInf_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normInf_32s), (NormFunc)GET_OPTIMIZED(normInf_32f), (NormFunc)normInf_64f, 0
|
||||
},
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normL1_8u), (NormFunc)GET_OPTIMIZED(normL1_8s), (NormFunc)GET_OPTIMIZED(normL1_16u), (NormFunc)GET_OPTIMIZED(normL1_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normL1_32s), (NormFunc)GET_OPTIMIZED(normL1_32f), (NormFunc)normL1_64f, 0
|
||||
},
|
||||
{
|
||||
(NormFunc)GET_OPTIMIZED(normL2_8u), (NormFunc)GET_OPTIMIZED(normL2_8s), (NormFunc)GET_OPTIMIZED(normL2_16u), (NormFunc)GET_OPTIMIZED(normL2_16s),
|
||||
(NormFunc)GET_OPTIMIZED(normL2_32s), (NormFunc)GET_OPTIMIZED(normL2_32f), (NormFunc)normL2_64f, 0
|
||||
}
|
||||
};
|
||||
|
||||
static NormDiffFunc normDiffTab[3][8] =
|
||||
return normTab[normType][depth];
|
||||
}
|
||||
|
||||
static NormDiffFunc getNormDiffFunc(int normType, int depth)
|
||||
{
|
||||
static NormDiffFunc normDiffTab[3][8] =
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffInf_8u), (NormDiffFunc)normDiffInf_8s,
|
||||
(NormDiffFunc)normDiffInf_16u, (NormDiffFunc)normDiffInf_16s,
|
||||
(NormDiffFunc)normDiffInf_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffInf_32f),
|
||||
(NormDiffFunc)normDiffInf_64f, 0
|
||||
},
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffL1_8u), (NormDiffFunc)normDiffL1_8s,
|
||||
(NormDiffFunc)normDiffL1_16u, (NormDiffFunc)normDiffL1_16s,
|
||||
(NormDiffFunc)normDiffL1_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffL1_32f),
|
||||
(NormDiffFunc)normDiffL1_64f, 0
|
||||
},
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffL2_8u), (NormDiffFunc)normDiffL2_8s,
|
||||
(NormDiffFunc)normDiffL2_16u, (NormDiffFunc)normDiffL2_16s,
|
||||
(NormDiffFunc)normDiffL2_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffL2_32f),
|
||||
(NormDiffFunc)normDiffL2_64f, 0
|
||||
}
|
||||
};
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffInf_8u), (NormDiffFunc)normDiffInf_8s,
|
||||
(NormDiffFunc)normDiffInf_16u, (NormDiffFunc)normDiffInf_16s,
|
||||
(NormDiffFunc)normDiffInf_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffInf_32f),
|
||||
(NormDiffFunc)normDiffInf_64f, 0
|
||||
},
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffL1_8u), (NormDiffFunc)normDiffL1_8s,
|
||||
(NormDiffFunc)normDiffL1_16u, (NormDiffFunc)normDiffL1_16s,
|
||||
(NormDiffFunc)normDiffL1_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffL1_32f),
|
||||
(NormDiffFunc)normDiffL1_64f, 0
|
||||
},
|
||||
{
|
||||
(NormDiffFunc)GET_OPTIMIZED(normDiffL2_8u), (NormDiffFunc)normDiffL2_8s,
|
||||
(NormDiffFunc)normDiffL2_16u, (NormDiffFunc)normDiffL2_16s,
|
||||
(NormDiffFunc)normDiffL2_32s, (NormDiffFunc)GET_OPTIMIZED(normDiffL2_32f),
|
||||
(NormDiffFunc)normDiffL2_64f, 0
|
||||
}
|
||||
};
|
||||
|
||||
return normDiffTab[normType][depth];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1485,7 +1514,7 @@ double cv::norm( InputArray _src, int normType, InputArray _mask )
|
||||
return result;
|
||||
}
|
||||
|
||||
NormFunc func = normTab[normType >> 1][depth];
|
||||
NormFunc func = getNormFunc(normType >> 1, depth);
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
const Mat* arrays[] = {&src, &mask, 0};
|
||||
@@ -1626,7 +1655,7 @@ double cv::norm( InputArray _src1, InputArray _src2, int normType, InputArray _m
|
||||
return result;
|
||||
}
|
||||
|
||||
NormDiffFunc func = normDiffTab[normType >> 1][depth];
|
||||
NormDiffFunc func = getNormDiffFunc(normType >> 1, depth);
|
||||
CV_Assert( func != 0 );
|
||||
|
||||
const Mat* arrays[] = {&src1, &src2, &mask, 0};
|
||||
|
@@ -391,7 +391,6 @@ protected:
|
||||
try
|
||||
{
|
||||
string fname = cv::tempfile(".xml");
|
||||
FileStorage fs(fname, FileStorage::WRITE);
|
||||
vector<int> mi, mi2, mi3, mi4;
|
||||
vector<Mat> mv, mv2, mv3, mv4;
|
||||
Mat m(10, 9, CV_32F);
|
||||
@@ -399,24 +398,59 @@ protected:
|
||||
randu(m, 0, 1);
|
||||
mi3.push_back(5);
|
||||
mv3.push_back(m);
|
||||
Point_<float> p1(1.1f, 2.2f), op1;
|
||||
Point3i p2(3, 4, 5), op2;
|
||||
Size s1(6, 7), os1;
|
||||
Complex<int> c1(9, 10), oc1;
|
||||
Rect r1(11, 12, 13, 14), or1;
|
||||
Vec<int, 5> v1(15, 16, 17, 18, 19), ov1;
|
||||
Scalar sc1(20.0, 21.1, 22.2, 23.3), osc1;
|
||||
Range g1(7, 8), og1;
|
||||
|
||||
FileStorage fs(fname, FileStorage::WRITE);
|
||||
fs << "mi" << mi;
|
||||
fs << "mv" << mv;
|
||||
fs << "mi3" << mi3;
|
||||
fs << "mv3" << mv3;
|
||||
fs << "empty" << empty;
|
||||
fs << "p1" << p1;
|
||||
fs << "p2" << p2;
|
||||
fs << "s1" << s1;
|
||||
fs << "c1" << c1;
|
||||
fs << "r1" << r1;
|
||||
fs << "v1" << v1;
|
||||
fs << "sc1" << sc1;
|
||||
fs << "g1" << g1;
|
||||
fs.release();
|
||||
|
||||
fs.open(fname, FileStorage::READ);
|
||||
fs["mi"] >> mi2;
|
||||
fs["mv"] >> mv2;
|
||||
fs["mi3"] >> mi4;
|
||||
fs["mv3"] >> mv4;
|
||||
fs["empty"] >> empty;
|
||||
fs["p1"] >> op1;
|
||||
fs["p2"] >> op2;
|
||||
fs["s1"] >> os1;
|
||||
fs["c1"] >> oc1;
|
||||
fs["r1"] >> or1;
|
||||
fs["v1"] >> ov1;
|
||||
fs["sc1"] >> osc1;
|
||||
fs["g1"] >> og1;
|
||||
CV_Assert( mi2.empty() );
|
||||
CV_Assert( mv2.empty() );
|
||||
CV_Assert( norm(mi3, mi4, CV_C) == 0 );
|
||||
CV_Assert( mv4.size() == 1 );
|
||||
double n = norm(mv3[0], mv4[0], CV_C);
|
||||
CV_Assert( n == 0 );
|
||||
CV_Assert( op1 == p1 );
|
||||
CV_Assert( op2 == p2 );
|
||||
CV_Assert( os1 == s1 );
|
||||
CV_Assert( oc1 == c1 );
|
||||
CV_Assert( or1 == r1 );
|
||||
CV_Assert( ov1 == v1 );
|
||||
CV_Assert( osc1 == sc1 );
|
||||
CV_Assert( og1 == g1 );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@@ -1 +0,0 @@
|
||||
#include "test_precomp.hpp"
|
Reference in New Issue
Block a user