Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
940eedfb
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
940eedfb
编写于
4月 02, 2013
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finalize core headers reorganization
上级
c979de1e
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
1127 addition
and
924 deletion
+1127
-924
modules/androidcamera/src/camera_activity.cpp
modules/androidcamera/src/camera_activity.cpp
+6
-1
modules/calib3d/src/circlesgrid.hpp
modules/calib3d/src/circlesgrid.hpp
+1
-0
modules/calib3d/test/test_stereomatching.cpp
modules/calib3d/test/test_stereomatching.cpp
+1
-0
modules/contrib/include/opencv2/contrib.hpp
modules/contrib/include/opencv2/contrib.hpp
+2
-0
modules/contrib/src/retina.cpp
modules/contrib/src/retina.cpp
+1
-0
modules/core/include/opencv2/core.hpp
modules/core/include/opencv2/core.hpp
+36
-12
modules/core/include/opencv2/core/affine.hpp
modules/core/include/opencv2/core/affine.hpp
+121
-73
modules/core/include/opencv2/core/core_c.h
modules/core/include/opencv2/core/core_c.h
+3
-3
modules/core/include/opencv2/core/cvdef.h
modules/core/include/opencv2/core/cvdef.h
+1
-1
modules/core/include/opencv2/core/cvstd.hpp
modules/core/include/opencv2/core/cvstd.hpp
+144
-74
modules/core/include/opencv2/core/cvstd.inl.hpp
modules/core/include/opencv2/core/cvstd.inl.hpp
+111
-14
modules/core/include/opencv2/core/eigen.hpp
modules/core/include/opencv2/core/eigen.hpp
+29
-50
modules/core/include/opencv2/core/gpumat.hpp
modules/core/include/opencv2/core/gpumat.hpp
+575
-539
modules/core/include/opencv2/core/mat.inl.hpp
modules/core/include/opencv2/core/mat.inl.hpp
+0
-5
modules/core/include/opencv2/core/opengl.hpp
modules/core/include/opencv2/core/opengl.hpp
+1
-5
modules/core/include/opencv2/core/operations.hpp
modules/core/include/opencv2/core/operations.hpp
+42
-129
modules/core/include/opencv2/core/persistence.hpp
modules/core/include/opencv2/core/persistence.hpp
+2
-0
modules/core/include/opencv2/core/private.hpp
modules/core/include/opencv2/core/private.hpp
+3
-1
modules/core/include/opencv2/core/traits.hpp
modules/core/include/opencv2/core/traits.hpp
+6
-1
modules/core/include/opencv2/core/types_c.h
modules/core/include/opencv2/core/types_c.h
+1
-0
modules/core/src/command_line_parser.cpp
modules/core/src/command_line_parser.cpp
+1
-0
modules/core/src/out.cpp
modules/core/src/out.cpp
+1
-2
modules/core/test/test_mat.cpp
modules/core/test/test_mat.cpp
+2
-0
modules/flann/src/miniflann.cpp
modules/flann/src/miniflann.cpp
+9
-9
modules/java/generator/src/cpp/Mat.cpp
modules/java/generator/src/cpp/Mat.cpp
+26
-3
modules/softcascade/include/opencv2/softcascade.hpp
modules/softcascade/include/opencv2/softcascade.hpp
+1
-0
modules/softcascade/src/integral_channel_builder.cpp
modules/softcascade/src/integral_channel_builder.cpp
+1
-2
未找到文件。
modules/androidcamera/src/camera_activity.cpp
浏览文件 @
940eedfb
...
...
@@ -29,6 +29,11 @@
#include <sys/types.h>
#include <dirent.h>
struct
str_greater
{
bool
operator
()
(
const
cv
::
String
&
a
,
const
cv
::
String
&
b
)
{
return
a
>
b
;
}
};
class
CameraWrapperConnector
{
public:
...
...
@@ -177,7 +182,7 @@ CameraActivity::ErrorCode CameraWrapperConnector::connectToLib()
std
::
vector
<
cv
::
String
>
listLibs
;
fillListWrapperLibs
(
folderPath
,
listLibs
);
std
::
sort
(
listLibs
.
begin
(),
listLibs
.
end
(),
st
d
::
greater
<
cv
::
String
>
());
std
::
sort
(
listLibs
.
begin
(),
listLibs
.
end
(),
st
r_greater
());
void
*
libHandle
=
0
;
cv
::
String
cur_path
;
...
...
modules/calib3d/src/circlesgrid.hpp
浏览文件 @
940eedfb
...
...
@@ -47,6 +47,7 @@
#include <set>
#include <list>
#include <numeric>
#include <map>
#include "precomp.hpp"
...
...
modules/calib3d/test/test_stereomatching.cpp
浏览文件 @
940eedfb
...
...
@@ -48,6 +48,7 @@
#include "test_precomp.hpp"
#include <limits>
#include <cstdio>
#include <map>
using
namespace
std
;
using
namespace
cv
;
...
...
modules/contrib/include/opencv2/contrib.hpp
浏览文件 @
940eedfb
...
...
@@ -48,6 +48,8 @@
#include "opencv2/features2d.hpp"
#include "opencv2/objdetect.hpp"
#include <ostream>
#ifdef __cplusplus
/****************************************************************************************\
...
...
modules/contrib/src/retina.cpp
浏览文件 @
940eedfb
...
...
@@ -71,6 +71,7 @@
#include "precomp.hpp"
#include "retinafilter.hpp"
#include <cstdio>
#include <sstream>
namespace
cv
{
...
...
modules/core/include/opencv2/core.hpp
浏览文件 @
940eedfb
...
...
@@ -57,18 +57,6 @@
#include "opencv2/core/mat.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 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 ////////////////////////////////////
class
CV_EXPORTS
Algorithm
;
...
...
modules/core/include/opencv2/core/affine.hpp
浏览文件 @
940eedfb
/*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) 2008-2013, 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*/
//
// 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.
// 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'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*/
#ifndef __OPENCV_CORE_AFFINE3_HPP__
#define __OPENCV_CORE_AFFINE3_HPP__
...
...
@@ -119,24 +120,36 @@ namespace cv
#endif
};
template
<
typename
T
>
Affine3
<
T
>
operator
*
(
const
Affine3
<
T
>&
affine1
,
const
Affine3
<
T
>&
affine2
);
template
<
typename
T
,
typename
V
>
V
operator
*
(
const
Affine3
<
T
>&
affine
,
const
V
&
vector
);
template
<
typename
T
>
static
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
<
double
>
Affine3d
;
cv
::
Vec3f
operator
*
(
const
cv
::
Affine3f
&
affine
,
const
cv
::
Vec3f
&
vector
);
cv
::
Vec3d
operator
*
(
const
cv
::
Affine3d
&
affine
,
const
cv
::
Vec3d
&
vector
);
static
cv
::
Vec3f
operator
*
(
const
cv
::
Affine3f
&
affine
,
const
cv
::
Vec3f
&
vector
);
static
cv
::
Vec3d
operator
*
(
const
cv
::
Affine3d
&
affine
,
const
cv
::
Vec3d
&
vector
);
}
///////////////////////////////////////////////////////////////////////////////////
/// Implementaiton
template
<
typename
T
>
inline
cv
::
Affine3
<
T
>::
Affine3
()
:
matrix
(
Mat4
::
eye
())
{}
template
<
typename
T
>
inline
cv
::
Affine3
<
T
>::
Affine3
(
const
Mat4
&
affine
)
:
matrix
(
affine
)
{}
template
<
typename
T
>
inline
cv
::
Affine3
<
T
>::
Affine3
()
:
matrix
(
Mat4
::
eye
())
{}
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
)
template
<
typename
T
>
inline
cv
::
Affine3
<
T
>::
Affine3
(
const
Mat3
&
R
,
const
Vec3
&
t
)
{
rotation
(
R
);
translation
(
t
);
...
...
@@ -144,7 +157,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const Mat3& R, const Vec3& t
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
);
translation
(
t
);
...
...
@@ -152,7 +166,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const Vec3& rvec, const Vec3
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
);
...
...
@@ -168,7 +183,8 @@ template<typename T> inline cv::Affine3<T>::Affine3(const cv::Mat& data, const V
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
);
translation
(
t
);
...
...
@@ -176,14 +192,20 @@ template<typename T> inline cv::Affine3<T>::Affine3(float_type alpha, float_type
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
());
}
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
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;
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
);
...
...
@@ -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"
);
}
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
));
}
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
[
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
];
}
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
];
}
template
<
typename
T
>
inline
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
template
<
typename
T
>
inline
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
;
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
;
}
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
]);
}
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
);
}
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
();
Vec3
tc
=
translation
();
...
...
@@ -295,7 +330,8 @@ template<typename T> inline cv::Affine3<T> cv::Affine3<T>::rotate(const Mat3& R)
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
;
m
.
val
[
3
]
+=
t
[
0
];
...
...
@@ -304,22 +340,26 @@ template<typename T> inline cv::Affine3<T> cv::Affine3<T>::translate(const Vec3&
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
());
}
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
);
}
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
);
}
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
;
...
...
@@ -330,7 +370,8 @@ template<typename T, typename V> inline V cv::operator*(const cv::Affine3<T>& af
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
;
cv
::
Vec3f
r
;
...
...
@@ -340,7 +381,8 @@ inline cv::Vec3f cv::operator*(const cv::Affine3f& affine, const cv::Vec3f& v)
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
;
cv
::
Vec3d
r
;
...
...
@@ -350,20 +392,25 @@ inline cv::Vec3d cv::operator*(const cv::Affine3d& affine, const cv::Vec3d& v)
return
r
;
}
#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
);
}
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
;
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
;
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
;
}
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
)
>
();
}
...
...
modules/core/include/opencv2/core/core_c.h
浏览文件 @
940eedfb
...
...
@@ -7,11 +7,12 @@
// copy or use the software.
//
//
//
License Agreement
// 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.
// 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,
...
...
@@ -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
<
CvSparseMat
>::
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 //////////////
...
...
@@ -2228,7 +2228,7 @@ template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
const
SeqIterator
<
_Tp
>&
b
)
{
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
;
return
delta
;
}
...
...
modules/core/include/opencv2/core/cvdef.h
浏览文件 @
940eedfb
...
...
@@ -111,7 +111,7 @@
#define CV_CPU_NEON 11
#define CV_HARDWARE_MAX_FEATURE 255
// d
isabl
e SSE/AVX/NEON headers for NVCC compiler
// d
o not includ
e SSE/AVX/NEON headers for NVCC compiler
#ifndef __CUDACC__
#if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
...
...
modules/core/include/opencv2/core/cvstd.hpp
浏览文件 @
940eedfb
...
...
@@ -62,6 +62,7 @@
#ifndef OPENCV_NOSTL_TRANSITIONAL
# include <algorithm>
# include <utility>
# include <cstdlib> //for abs(int)
# include <cmath>
namespace
cv
...
...
@@ -70,19 +71,31 @@ namespace cv
using
std
::
max
;
using
std
::
abs
;
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
namespace
cv
{
template
<
typename
T
>
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
>
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
T
min
(
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
>
static
inline
T
abs
(
T
a
)
{
return
a
<
0
?
-
a
:
a
;
}
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
ushort
abs
(
ushort
a
)
{
return
a
;
}
template
<
>
inline
u
int
abs
(
uint
a
)
{
return
a
;
}
template
<
>
inline
u
nsigned
abs
(
unsigned
a
)
{
return
a
;
}
template
<
>
inline
uint64
abs
(
uint64
a
)
{
return
a
;
}
}
#endif
...
...
@@ -483,17 +496,22 @@ bool operator != (const Ptr<_Tp>& a, const Ptr<_Tp2>& b)
////////////////////////// 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_
)
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_
);
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
);
}
inline
String
::
String
(
const
char
*
s
)
:
cstr_
(
0
),
len_
(
0
)
inline
String
::
String
(
const
char
*
s
)
:
cstr_
(
0
),
len_
(
0
)
{
if
(
!
s
)
return
;
size_t
len
=
strlen
(
s
);
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
;
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
);
}
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
);
memcpy
(
allocate
(
len
),
first
,
len
);
}
template
<
typename
Iterator
>
inline
String
::
String
(
Iterator
first
,
Iterator
last
)
:
cstr_
(
0
),
len_
(
0
)
template
<
typename
Iterator
>
inline
String
::
String
(
Iterator
first
,
Iterator
last
)
:
cstr_
(
0
),
len_
(
0
)
{
size_t
len
=
(
size_t
)(
last
-
first
);
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
();
}
inline
String
&
String
::
operator
=
(
const
String
&
str
)
inline
String
&
String
::
operator
=
(
const
String
&
str
)
{
deallocate
();
if
(
str
.
cstr_
)
CV_XADD
(((
int
*
)
str
.
cstr_
)
-
1
,
1
);
...
...
@@ -558,7 +587,8 @@ inline String& String::operator=(const String& str)
return
*
this
;
}
inline
String
&
String
::
operator
=
(
const
char
*
s
)
inline
String
&
String
::
operator
=
(
const
char
*
s
)
{
deallocate
();
if
(
!
s
)
return
*
this
;
...
...
@@ -567,82 +597,97 @@ inline String& String::operator=(const char* s)
return
*
this
;
}
inline
String
&
String
::
operator
=
(
char
c
)
inline
String
&
String
::
operator
=
(
char
c
)
{
deallocate
();
allocate
(
1
)[
0
]
=
c
;
return
*
this
;
}
inline
size_t
String
::
size
()
const
inline
size_t
String
::
size
()
const
{
return
len_
;
}
inline
size_t
String
::
length
()
const
inline
size_t
String
::
length
()
const
{
return
len_
;
}
inline
char
String
::
operator
[](
size_t
idx
)
const
inline
char
String
::
operator
[](
size_t
idx
)
const
{
return
cstr_
[
idx
];
}
inline
char
String
::
operator
[](
int
idx
)
const
inline
char
String
::
operator
[](
int
idx
)
const
{
return
cstr_
[
idx
];
}
inline
const
char
*
String
::
begin
()
const
inline
const
char
*
String
::
begin
()
const
{
return
cstr_
;
}
inline
const
char
*
String
::
end
()
const
inline
const
char
*
String
::
end
()
const
{
return
len_
?
cstr_
+
1
:
0
;
}
inline
bool
String
::
empty
()
const
inline
bool
String
::
empty
()
const
{
return
len_
==
0
;
}
inline
const
char
*
String
::
c_str
()
const
inline
const
char
*
String
::
c_str
()
const
{
return
cstr_
?
cstr_
:
""
;
}
inline
void
String
::
swap
(
String
&
str
)
inline
void
String
::
swap
(
String
&
str
)
{
cv
::
swap
(
cstr_
,
str
.
cstr_
);
cv
::
swap
(
len_
,
str
.
len_
);
}
inline
void
String
::
clear
()
inline
void
String
::
clear
()
{
deallocate
();
}
inline
int
String
::
compare
(
const
char
*
s
)
const
inline
int
String
::
compare
(
const
char
*
s
)
const
{
if
(
cstr_
==
s
)
return
0
;
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
;
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
);
}
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
;
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
;
}
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
);
}
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_
);
}
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
;
const
char
*
lmax
=
cstr_
+
len_
;
...
...
@@ -681,7 +729,8 @@ inline size_t String::find(const char* s, size_t pos) const
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
(
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
;
}
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
);
}
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_
);
}
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
));
}
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
;
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
;
}
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
);
}
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_
);
}
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
;
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
;
}
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
;
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
;
}
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
);
}
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_
);
}
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
;
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
;
}
inline
String
String
::
toLowerCase
()
const
inline
String
String
::
toLowerCase
()
const
{
String
res
(
cstr_
,
len_
);
...
...
@@ -791,7 +852,8 @@ inline String String::toLowerCase() const
// ************************* 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
;
s
.
allocate
(
lhs
.
len_
+
rhs
.
len_
);
...
...
@@ -800,7 +862,8 @@ inline String operator+ (const String& lhs, const String& rhs)
return
s
;
}
inline
String
operator
+
(
const
String
&
lhs
,
const
char
*
rhs
)
inline
String
operator
+
(
const
String
&
lhs
,
const
char
*
rhs
)
{
String
s
;
size_t
rhslen
=
strlen
(
rhs
);
...
...
@@ -810,7 +873,8 @@ inline String operator+ (const String& lhs, const char* rhs)
return
s
;
}
inline
String
operator
+
(
const
char
*
lhs
,
const
String
&
rhs
)
inline
String
operator
+
(
const
char
*
lhs
,
const
String
&
rhs
)
{
String
s
;
size_t
lhslen
=
strlen
(
lhs
);
...
...
@@ -820,7 +884,8 @@ inline String operator+ (const char* lhs, const String& rhs)
return
s
;
}
inline
String
operator
+
(
const
String
&
lhs
,
char
rhs
)
inline
String
operator
+
(
const
String
&
lhs
,
char
rhs
)
{
String
s
;
s
.
allocate
(
lhs
.
len_
+
1
);
...
...
@@ -829,7 +894,8 @@ inline String operator+ (const String& lhs, char rhs)
return
s
;
}
inline
String
operator
+
(
char
lhs
,
const
String
&
rhs
)
inline
String
operator
+
(
char
lhs
,
const
String
&
rhs
)
{
String
s
;
s
.
allocate
(
rhs
.
len_
+
1
);
...
...
@@ -838,24 +904,24 @@ inline String operator+ (char lhs, const String& rhs)
return
s
;
}
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
);
}
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
);
}
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
);
}
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
;
}
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
;
}
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
;
}
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
;
}
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
;
}
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
String
&
rhs
)
{
return
0
==
lhs
.
compare
(
rhs
);
}
static
inline
bool
operator
==
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
0
==
rhs
.
compare
(
lhs
);
}
static
inline
bool
operator
==
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
0
==
lhs
.
compare
(
rhs
);
}
static
inline
bool
operator
!=
(
const
String
&
lhs
,
const
String
&
rhs
)
{
return
0
!=
lhs
.
compare
(
rhs
);
}
static
inline
bool
operator
!=
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
0
!=
rhs
.
compare
(
lhs
);
}
static
inline
bool
operator
!=
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
0
!=
lhs
.
compare
(
rhs
);
}
static
inline
bool
operator
<
(
const
String
&
lhs
,
const
String
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<
0
;
}
static
inline
bool
operator
<
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
>
0
;
}
static
inline
bool
operator
<
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
lhs
.
compare
(
rhs
)
<
0
;
}
static
inline
bool
operator
<=
(
const
String
&
lhs
,
const
String
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
<=
0
;
}
static
inline
bool
operator
<=
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
>=
0
;
}
static
inline
bool
operator
<=
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
lhs
.
compare
(
rhs
)
<=
0
;
}
static
inline
bool
operator
>
(
const
String
&
lhs
,
const
String
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>
0
;
}
static
inline
bool
operator
>
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
<
0
;
}
static
inline
bool
operator
>
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
lhs
.
compare
(
rhs
)
>
0
;
}
static
inline
bool
operator
>=
(
const
String
&
lhs
,
const
String
&
rhs
)
{
return
lhs
.
compare
(
rhs
)
>=
0
;
}
static
inline
bool
operator
>=
(
const
char
*
lhs
,
const
String
&
rhs
)
{
return
rhs
.
compare
(
lhs
)
<=
0
;
}
static
inline
bool
operator
>=
(
const
String
&
lhs
,
const
char
*
rhs
)
{
return
lhs
.
compare
(
rhs
)
>=
0
;
}
}
// cv
...
...
@@ -865,7 +931,11 @@ namespace std
namespace
cv
#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__
modules/core/include/opencv2/core/cvstd.inl.hpp
浏览文件 @
940eedfb
...
...
@@ -68,7 +68,9 @@ public:
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
())
{
...
...
@@ -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
();
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
);
}
inline
String
&
String
::
operator
=
(
const
std
::
string
&
str
)
inline
String
&
String
::
operator
=
(
const
std
::
string
&
str
)
{
deallocate
();
if
(
!
str
.
empty
())
...
...
@@ -97,12 +102,14 @@ inline String& String::operator=(const std::string& str)
return
*
this
;
}
inline
String
::
operator
std
::
string
()
const
inline
String
::
operator
std
::
string
()
const
{
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
;
size_t
rhslen
=
rhs
.
size
();
...
...
@@ -112,7 +119,8 @@ inline String operator+ (const String& lhs, const std::string& rhs)
return
s
;
}
inline
String
operator
+
(
const
std
::
string
&
lhs
,
const
String
&
rhs
)
inline
String
operator
+
(
const
std
::
string
&
lhs
,
const
String
&
rhs
)
{
String
s
;
size_t
lhslen
=
lhs
.
size
();
...
...
@@ -122,30 +130,119 @@ inline String operator+ (const std::string& lhs, const String& rhs)
return
s
;
}
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
String
&
str
)
{
return
os
<<
str
.
c_str
();
}
inline
FileNode
::
operator
std
::
string
()
const
inline
FileNode
::
operator
std
::
string
()
const
{
String
value
;
read
(
*
this
,
value
,
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
;
read
(
n
,
val
,
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
);
}
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
}
// cv
...
...
modules/core/include/opencv2/core/eigen.hpp
浏览文件 @
940eedfb
...
...
@@ -12,6 +12,7 @@
//
// Copyright (C) 2000-2008, Intel Corporation, 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.
//
// Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -40,12 +41,10 @@
//
//M*/
#ifndef __OPENCV_CORE_EIGEN_HPP__
#define __OPENCV_CORE_EIGEN_HPP__
#ifdef __cplusplus
#include "opencv2/core/core_c.h"
#include "opencv2/core.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
...
...
@@ -57,7 +56,7 @@
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
)
{
if
(
!
(
src
.
Flags
&
Eigen
::
RowMajorBit
)
)
...
...
@@ -75,7 +74,7 @@ void eigen2cv( const Eigen::Matrix<_Tp, _rows, _cols, _options, _maxRows, _maxCo
}
// 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
,
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
,
Eigen
::
Matrix
<
_Tp
,
_rows
,
_cols
,
_options
,
_maxRows
,
_maxCols
>&
dst
)
{
CV_DbgAssert
(
src
.
rows
==
_rows
&&
src
.
cols
==
_cols
);
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
)));
if
(
src
.
type
()
==
_dst
.
type
()
)
transpose
(
src
,
_dst
);
...
...
@@ -107,46 +106,42 @@ void cv2eigen( const Mat& src,
}
else
Mat
(
src
.
t
()).
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
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
)));
src
.
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
// 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
,
Eigen
::
Matrix
<
_Tp
,
_rows
,
_cols
,
_options
,
_maxRows
,
_maxCols
>&
dst
)
{
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
)));
transpose
(
src
,
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
else
{
Mat
_dst
(
_rows
,
_cols
,
DataType
<
_Tp
>::
type
,
const
Mat
_dst
(
_rows
,
_cols
,
DataType
<
_Tp
>::
type
,
dst
.
data
(),
(
size_t
)(
dst
.
stride
()
*
sizeof
(
_Tp
)));
Mat
(
src
).
copyTo
(
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
template
<
typename
_Tp
>
template
<
typename
_Tp
>
static
inline
void
cv2eigen
(
const
Mat
&
src
,
Eigen
::
Matrix
<
_Tp
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>&
dst
)
{
dst
.
resize
(
src
.
rows
,
src
.
cols
);
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
)));
if
(
src
.
type
()
==
_dst
.
type
()
)
transpose
(
src
,
_dst
);
...
...
@@ -157,40 +152,36 @@ void cv2eigen( const Mat& src,
}
else
Mat
(
src
.
t
()).
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
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
)));
src
.
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
// 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
,
Eigen
::
Matrix
<
_Tp
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
>&
dst
)
{
dst
.
resize
(
_rows
,
_cols
);
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
)));
transpose
(
src
,
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
else
{
Mat
_dst
(
_rows
,
_cols
,
DataType
<
_Tp
>::
type
,
const
Mat
_dst
(
_rows
,
_cols
,
DataType
<
_Tp
>::
type
,
dst
.
data
(),
(
size_t
)(
dst
.
stride
()
*
sizeof
(
_Tp
)));
Mat
(
src
).
copyTo
(
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
template
<
typename
_Tp
>
template
<
typename
_Tp
>
static
inline
void
cv2eigen
(
const
Mat
&
src
,
Eigen
::
Matrix
<
_Tp
,
Eigen
::
Dynamic
,
1
>&
dst
)
{
...
...
@@ -199,25 +190,23 @@ void cv2eigen( const Mat& src,
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
)));
if
(
src
.
type
()
==
_dst
.
type
()
)
transpose
(
src
,
_dst
);
else
Mat
(
src
.
t
()).
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
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
)));
src
.
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
// Matx case
template
<
typename
_Tp
,
int
_rows
>
template
<
typename
_Tp
,
int
_rows
>
static
inline
void
cv2eigen
(
const
Matx
<
_Tp
,
_rows
,
1
>&
src
,
Eigen
::
Matrix
<
_Tp
,
Eigen
::
Dynamic
,
1
>&
dst
)
{
...
...
@@ -225,22 +214,20 @@ void cv2eigen( const Matx<_Tp, _rows, 1>& src,
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
)));
transpose
(
src
,
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
else
{
Mat
_dst
(
_rows
,
1
,
DataType
<
_Tp
>::
type
,
const
Mat
_dst
(
_rows
,
1
,
DataType
<
_Tp
>::
type
,
dst
.
data
(),
(
size_t
)(
dst
.
stride
()
*
sizeof
(
_Tp
)));
src
.
copyTo
(
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
template
<
typename
_Tp
>
template
<
typename
_Tp
>
static
inline
void
cv2eigen
(
const
Mat
&
src
,
Eigen
::
Matrix
<
_Tp
,
1
,
Eigen
::
Dynamic
>&
dst
)
{
...
...
@@ -248,49 +235,41 @@ void cv2eigen( const Mat& src,
dst
.
resize
(
src
.
cols
);
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
)));
if
(
src
.
type
()
==
_dst
.
type
()
)
transpose
(
src
,
_dst
);
else
Mat
(
src
.
t
()).
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
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
)));
src
.
convertTo
(
_dst
,
_dst
.
type
());
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
//Matx
template
<
typename
_Tp
,
int
_cols
>
template
<
typename
_Tp
,
int
_cols
>
static
inline
void
cv2eigen
(
const
Matx
<
_Tp
,
1
,
_cols
>&
src
,
Eigen
::
Matrix
<
_Tp
,
1
,
Eigen
::
Dynamic
>&
dst
)
{
dst
.
resize
(
_cols
);
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
)));
transpose
(
src
,
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
else
{
Mat
_dst
(
1
,
_cols
,
DataType
<
_Tp
>::
type
,
const
Mat
_dst
(
1
,
_cols
,
DataType
<
_Tp
>::
type
,
dst
.
data
(),
(
size_t
)(
dst
.
stride
()
*
sizeof
(
_Tp
)));
Mat
(
src
).
copyTo
(
_dst
);
CV_DbgAssert
(
_dst
.
data
==
(
uchar
*
)
dst
.
data
());
}
}
}
}
// cv
#endif
#endif
modules/core/include/opencv2/core/gpumat.hpp
浏览文件 @
940eedfb
...
...
@@ -7,11 +7,12 @@
// copy or use the software.
//
//
//
License Agreement
// 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.
// 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,
...
...
@@ -40,652 +41,687 @@
//
//M*/
#ifndef __OPENCV_GPUMAT_HPP__
#define __OPENCV_GPUMAT_HPP__
#ifdef __cplusplus
#include "opencv2/core.hpp"
#include "opencv2/core/cuda_devptrs.hpp"
namespace
cv
{
namespace
gpu
{
//////////////////////////////// CudaMem ////////////////////////////////
// CudaMem is limited cv::Mat with page locked memory allocation.
// Page locked memory is only needed for async and faster coping to GPU.
// It is convertable to cv::Mat header without reference counting
// so you can use it with other opencv functions.
//////////////////////////////// CudaMem ////////////////////////////////
// CudaMem is limited cv::Mat with page locked memory allocation.
// Page locked memory is only needed for async and faster coping to GPU.
// It is convertable to cv::Mat header without reference counting
// so you can use it with other opencv functions.
// Page-locks the matrix m memory and maps it for the device(s)
CV_EXPORTS
void
registerPageLocked
(
Mat
&
m
);
// Unmaps the memory of matrix m, and makes it pageable again.
CV_EXPORTS
void
unregisterPageLocked
(
Mat
&
m
);
// Page-locks the matrix m memory and maps it for the device(s)
CV_EXPORTS
void
registerPageLocked
(
Mat
&
m
);
class
CV_EXPORTS
CudaMem
{
public:
enum
{
ALLOC_PAGE_LOCKED
=
1
,
ALLOC_ZEROCOPY
=
2
,
ALLOC_WRITE_COMBINED
=
4
};
// Unmaps the memory of matrix m, and makes it pageable again.
CV_EXPORTS
void
unregisterPageLocked
(
Mat
&
m
);
CudaMem
();
CudaMem
(
const
CudaMem
&
m
);
class
CV_EXPORTS
CudaMem
{
public:
enum
{
ALLOC_PAGE_LOCKED
=
1
,
ALLOC_ZEROCOPY
=
2
,
ALLOC_WRITE_COMBINED
=
4
};
CudaMem
(
int
rows
,
int
cols
,
int
type
,
int
_alloc_type
=
ALLOC_PAGE_LOCKED
);
CudaMem
(
Size
size
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
CudaMem
(
);
CudaMem
(
const
CudaMem
&
m
);
CudaMem
(
int
rows
,
int
cols
,
int
type
,
int
_alloc_type
=
ALLOC_PAGE_LOCKED
);
CudaMem
(
Size
size
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
//! creates from cv::Mat with coping data
explicit
CudaMem
(
const
Mat
&
m
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
~
CudaMem
();
//! creates from cv::Mat with coping data
explicit
CudaMem
(
const
Mat
&
m
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
CudaMem
&
operator
=
(
const
CudaMem
&
m
);
~
CudaMem
(
);
//! returns deep copy of the matrix, i.e. the data is copied
CudaMem
clone
()
const
;
CudaMem
&
operator
=
(
const
CudaMem
&
m
);
//! allocates new matrix data unless the matrix already has specified size and type.
void
create
(
int
rows
,
int
cols
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
void
create
(
Size
size
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
//! returns deep copy of the matrix, i.e. the data is copied
CudaMem
clone
()
const
;
//! decrements reference counter and released memory if needed.
void
release
();
//! allocates new matrix data unless the matrix already has specified size and type.
void
create
(
int
rows
,
int
cols
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
void
create
(
Size
size
,
int
type
,
int
alloc_type
=
ALLOC_PAGE_LOCKED
);
//! returns matrix header with disabled reference counting for CudaMem data.
Mat
createMatHeader
()
const
;
operator
Mat
()
const
;
//! decrements reference counter and released memory if needed.
void
release
();
//! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware
.
GpuMat
createGpu
MatHeader
()
const
;
operator
Gpu
Mat
()
const
;
//! returns matrix header with disabled reference counting for CudaMem data
.
Mat
create
MatHeader
()
const
;
operator
Mat
()
const
;
//returns if host memory can be mapperd to gpu address space;
static
bool
canMapHostMemory
();
//! maps host memory into device address space and returns GpuMat header for it. Throws exception if not supported by hardware.
GpuMat
createGpuMatHeader
()
const
;
operator
GpuMat
()
const
;
// Please see cv::Mat for descriptions
bool
isContinuous
()
const
;
size_t
elemSize
()
const
;
size_t
elemSize1
()
const
;
int
type
()
const
;
int
depth
()
const
;
int
channels
()
const
;
size_t
step1
()
const
;
Size
size
()
const
;
bool
empty
()
const
;
//returns if host memory can be mapperd to gpu address space;
static
bool
canMapHostMemory
();
// Please see cv::Mat for descriptions
bool
isContinuous
()
const
;
size_t
elemSize
()
const
;
size_t
elemSize1
()
const
;
int
type
()
const
;
int
depth
()
const
;
int
channels
()
const
;
size_t
step1
()
const
;
Size
size
()
const
;
bool
empty
()
const
;
// Please see cv::Mat for descriptions
int
flags
;
int
rows
,
cols
;
size_t
step
;
uchar
*
data
;
int
*
refcount
;
// Please see cv::Mat for descriptions
int
flags
;
int
rows
,
cols
;
size_t
step
;
uchar
*
datastart
;
uchar
*
dataend
;
uchar
*
data
;
int
*
refcount
;
int
alloc_type
;
}
;
uchar
*
datastart
;
uchar
*
dataend
;
int
alloc_type
;
};
//////////////////////////////// CudaStream ////////////////////////////////
// Encapculates Cuda Stream. Provides interface for async coping.
// Passed to each function that supports async kernel execution.
// Reference counting is enabled
class
CV_EXPORTS
Stream
{
public:
Stream
();
~
Stream
();
//////////////////////////////// CudaStream ////////////////////////////////
// Encapculates Cuda Stream. Provides interface for async coping.
// Passed to each function that supports async kernel execution.
// Reference counting is enabled
Stream
(
const
Stream
&
);
Stream
&
operator
=
(
const
Stream
&
);
class
CV_EXPORTS
Stream
{
public:
Stream
();
~
Stream
();
bool
queryIfComplete
(
);
void
waitForCompletion
(
);
Stream
(
const
Stream
&
);
Stream
&
operator
=
(
const
Stream
&
);
//! downloads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat)
void
enqueueDownload
(
const
GpuMat
&
src
,
CudaMem
&
dst
);
void
enqueueDownload
(
const
GpuMat
&
src
,
Mat
&
dst
);
bool
queryIfComplete
();
void
waitForCompletion
();
//! up
loads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI
)
void
enqueueUpload
(
const
CudaMem
&
src
,
GpuMat
&
dst
);
void
enqueueUpload
(
const
Mat
&
src
,
Gpu
Mat
&
dst
);
//! down
loads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its subMat
)
void
enqueueDownload
(
const
GpuMat
&
src
,
CudaMem
&
dst
);
void
enqueueDownload
(
const
GpuMat
&
src
,
Mat
&
dst
);
//! copy asynchronously
void
enqueueCopy
(
const
GpuMat
&
src
,
GpuMat
&
dst
);
//! uploads asynchronously
// Warning! cv::Mat must point to page locked memory (i.e. to CudaMem data or to its ROI)
void
enqueueUpload
(
const
CudaMem
&
src
,
GpuMat
&
dst
);
void
enqueueUpload
(
const
Mat
&
src
,
GpuMat
&
dst
);
//! memory set asynchronously
void
enqueueMemSet
(
GpuMat
&
src
,
Scalar
val
);
void
enqueueMemSet
(
GpuMat
&
src
,
Scalar
val
,
const
GpuMat
&
mask
);
//! copy asynchronously
void
enqueueCopy
(
const
GpuMat
&
src
,
GpuMat
&
dst
);
//! converts matrix type, ex from float to uchar depending on type
void
enqueueConvert
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
dtype
,
double
a
=
1
,
double
b
=
0
);
//! memory set asynchronously
void
enqueueMemSet
(
GpuMat
&
src
,
Scalar
val
);
void
enqueueMemSet
(
GpuMat
&
src
,
Scalar
val
,
const
GpuMat
&
mask
);
//! adds a callback to be called on the host after all currently enqueued items in the stream have completed
typedef
void
(
*
StreamCallback
)(
Stream
&
stream
,
int
status
,
void
*
userData
);
void
enqueueHostCallback
(
StreamCallback
callback
,
void
*
userData
);
//! converts matrix type, ex from float to uchar depending on type
void
enqueueConvert
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
dtype
,
double
a
=
1
,
double
b
=
0
);
static
Stream
&
Null
();
//! adds a callback to be called on the host after all currently enqueued items in the stream have completed
typedef
void
(
*
StreamCallback
)(
Stream
&
stream
,
int
status
,
void
*
userData
);
void
enqueueHostCallback
(
StreamCallback
callback
,
void
*
userData
);
operator
bool
()
const
;
static
Stream
&
Null
()
;
private:
struct
Impl
;
operator
bool
()
const
;
explicit
Stream
(
Impl
*
impl
);
void
create
();
void
release
();
private:
struct
Impl
;
Impl
*
impl
;
explicit
Stream
(
Impl
*
impl
);
void
create
();
void
release
();
friend
struct
StreamAccessor
;
};
Impl
*
impl
;
//////////////////////////////// Initialization & Info ////////////////////////
friend
struct
StreamAccessor
;
};
//! This is the only function that do not throw exceptions if the library is compiled without Cuda.
CV_EXPORTS
int
getCudaEnabledDeviceCount
();
//////////////////////////////// Initialization & Info ////////////////////////
//! Functions below throw cv::Expception if the library is compiled without Cuda.
//! This is the only function that do not throw exceptions if the library is compiled without Cuda.
CV_EXPORTS
int
getCudaEnabledDeviceCount
();
CV_EXPORTS
void
setDevice
(
int
device
);
CV_EXPORTS
int
getDevice
();
//! Functions below throw cv::Expception if the library is compiled without Cuda.
//! Explicitly destroys and cleans up all resources associated with the current device in the current process.
//! Any subsequent API call to this device will reinitialize the device.
CV_EXPORTS
void
resetDevice
();
CV_EXPORTS
void
setDevice
(
int
device
);
enum
FeatureSet
{
FEATURE_SET_COMPUTE_10
=
10
,
FEATURE_SET_COMPUTE_11
=
11
,
FEATURE_SET_COMPUTE_12
=
12
,
FEATURE_SET_COMPUTE_13
=
13
,
FEATURE_SET_COMPUTE_20
=
20
,
FEATURE_SET_COMPUTE_21
=
21
,
FEATURE_SET_COMPUTE_30
=
30
,
FEATURE_SET_COMPUTE_35
=
35
,
GLOBAL_ATOMICS
=
FEATURE_SET_COMPUTE_11
,
SHARED_ATOMICS
=
FEATURE_SET_COMPUTE_12
,
NATIVE_DOUBLE
=
FEATURE_SET_COMPUTE_13
,
WARP_SHUFFLE_FUNCTIONS
=
FEATURE_SET_COMPUTE_30
,
DYNAMIC_PARALLELISM
=
FEATURE_SET_COMPUTE_35
};
// Checks whether current device supports the given feature
CV_EXPORTS
bool
deviceSupports
(
FeatureSet
feature_set
);
// Gives information about what GPU archs this OpenCV GPU module was
// compiled for
class
CV_EXPORTS
TargetArchs
{
public:
static
bool
builtWith
(
FeatureSet
feature_set
);
static
bool
has
(
int
major
,
int
minor
);
static
bool
hasPtx
(
int
major
,
int
minor
);
static
bool
hasBin
(
int
major
,
int
minor
);
static
bool
hasEqualOrLessPtx
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreater
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreaterPtx
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreaterBin
(
int
major
,
int
minor
);
private:
TargetArchs
();
};
// Gives information about the given GPU
class
CV_EXPORTS
DeviceInfo
{
public:
// Creates DeviceInfo object for the current GPU
DeviceInfo
()
:
device_id_
(
getDevice
())
{
query
();
}
CV_EXPORTS
int
getDevice
();
// Creates DeviceInfo object for the given GPU
DeviceInfo
(
int
device_id
)
:
device_id_
(
device_id
)
{
query
();
}
//! Explicitly destroys and cleans up all resources associated with the current device in the current process.
//! Any subsequent API call to this device will reinitialize the device.
CV_EXPORTS
void
resetDevice
();
String
name
()
const
{
return
name_
;
}
enum
FeatureSet
{
FEATURE_SET_COMPUTE_10
=
10
,
FEATURE_SET_COMPUTE_11
=
11
,
FEATURE_SET_COMPUTE_12
=
12
,
FEATURE_SET_COMPUTE_13
=
13
,
FEATURE_SET_COMPUTE_20
=
20
,
FEATURE_SET_COMPUTE_21
=
21
,
FEATURE_SET_COMPUTE_30
=
30
,
FEATURE_SET_COMPUTE_35
=
35
,
GLOBAL_ATOMICS
=
FEATURE_SET_COMPUTE_11
,
SHARED_ATOMICS
=
FEATURE_SET_COMPUTE_12
,
NATIVE_DOUBLE
=
FEATURE_SET_COMPUTE_13
,
WARP_SHUFFLE_FUNCTIONS
=
FEATURE_SET_COMPUTE_30
,
DYNAMIC_PARALLELISM
=
FEATURE_SET_COMPUTE_35
};
// Checks whether current device supports the given feature
CV_EXPORTS
bool
deviceSupports
(
FeatureSet
feature_set
);
// Gives information about what GPU archs this OpenCV GPU module was
// compiled for
class
CV_EXPORTS
TargetArchs
{
public:
static
bool
builtWith
(
FeatureSet
feature_set
);
static
bool
has
(
int
major
,
int
minor
);
static
bool
hasPtx
(
int
major
,
int
minor
);
static
bool
hasBin
(
int
major
,
int
minor
);
static
bool
hasEqualOrLessPtx
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreater
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreaterPtx
(
int
major
,
int
minor
);
static
bool
hasEqualOrGreaterBin
(
int
major
,
int
minor
);
private:
TargetArchs
();
};
// Gives information about the given GPU
class
CV_EXPORTS
DeviceInfo
{
public:
// Creates DeviceInfo object for the current GPU
DeviceInfo
()
:
device_id_
(
getDevice
())
{
query
();
}
// Return compute capability versions
int
majorVersion
()
const
{
return
majorVersion_
;
}
int
minorVersion
()
const
{
return
minorVersion_
;
}
// Creates DeviceInfo object for the given GPU
DeviceInfo
(
int
device_id
)
:
device_id_
(
device_id
)
{
query
();
}
int
multiProcessorCount
()
const
{
return
multi_processor_count
_
;
}
String
name
()
const
{
return
name
_
;
}
size_t
sharedMemPerBlock
()
const
;
// Return compute capability versions
int
majorVersion
()
const
{
return
majorVersion_
;
}
int
minorVersion
()
const
{
return
minorVersion_
;
}
void
queryMemory
(
size_t
&
totalMemory
,
size_t
&
freeMemory
)
const
;
size_t
freeMemory
()
const
;
size_t
totalMemory
()
const
;
int
multiProcessorCount
()
const
{
return
multi_processor_count_
;
}
// Checks whether device supports the given feature
bool
supports
(
FeatureSet
feature_set
)
const
;
size_t
sharedMemPerBlock
()
const
;
// Checks whether the GPU module can be run on the given device
bool
isCompatible
()
const
;
void
queryMemory
(
size_t
&
totalMemory
,
size_t
&
freeMemory
)
const
;
size_t
freeMemory
()
const
;
size_t
totalMemory
()
const
;
int
deviceID
()
const
{
return
device_id_
;
}
// Checks whether device supports the given feature
bool
supports
(
FeatureSet
feature_set
)
const
;
private:
void
query
()
;
// Checks whether the GPU module can be run on the given device
bool
isCompatible
()
const
;
int
device_id_
;
int
deviceID
()
const
{
return
device_id_
;
}
String
name_
;
int
multi_processor_count_
;
int
majorVersion_
;
int
minorVersion_
;
};
private:
void
query
();
CV_EXPORTS
void
printCudaDeviceInfo
(
int
device
);
CV_EXPORTS
void
printShortCudaDeviceInfo
(
int
device
);
int
device_id_
;
//////////////////////////////// GpuMat ///////////////////////////////
String
name_
;
int
multi_processor_count_
;
int
majorVersion_
;
int
minorVersion_
;
};
//! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
class
CV_EXPORTS
GpuMat
{
public:
//! default constructor
GpuMat
();
//! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
GpuMat
(
int
rows
,
int
cols
,
int
type
);
GpuMat
(
Size
size
,
int
type
);
//! constucts GpuMatrix and fills it with the specified value _s.
GpuMat
(
int
rows
,
int
cols
,
int
type
,
Scalar
s
);
GpuMat
(
Size
size
,
int
type
,
Scalar
s
);
//! copy constructor
GpuMat
(
const
GpuMat
&
m
);
//! constructor for GpuMatrix headers pointing to user-allocated data
GpuMat
(
int
rows
,
int
cols
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
GpuMat
(
Size
size
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
//! creates a matrix header for a part of the bigger matrix
GpuMat
(
const
GpuMat
&
m
,
Range
rowRange
,
Range
colRange
);
GpuMat
(
const
GpuMat
&
m
,
Rect
roi
);
//! builds GpuMat from Mat. Perfom blocking upload to device.
explicit
GpuMat
(
const
Mat
&
m
);
//! destructor - calls release()
~
GpuMat
();
//! assignment operators
GpuMat
&
operator
=
(
const
GpuMat
&
m
);
//! pefroms blocking upload data to GpuMat.
void
upload
(
const
Mat
&
m
);
//! downloads data from device to host memory. Blocking calls.
void
download
(
Mat
&
m
)
const
;
//! returns a new GpuMatrix header for the specified row
GpuMat
row
(
int
y
)
const
;
//! returns a new GpuMatrix header for the specified column
GpuMat
col
(
int
x
)
const
;
//! ... for the specified row span
GpuMat
rowRange
(
int
startrow
,
int
endrow
)
const
;
GpuMat
rowRange
(
Range
r
)
const
;
//! ... for the specified column span
GpuMat
colRange
(
int
startcol
,
int
endcol
)
const
;
GpuMat
colRange
(
Range
r
)
const
;
//! returns deep copy of the GpuMatrix, i.e. the data is copied
GpuMat
clone
()
const
;
//! copies the GpuMatrix content to "m".
// It calls m.create(this->size(), this->type()).
void
copyTo
(
GpuMat
&
m
)
const
;
//! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
void
copyTo
(
GpuMat
&
m
,
const
GpuMat
&
mask
)
const
;
//! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
void
convertTo
(
GpuMat
&
m
,
int
rtype
,
double
alpha
=
1
,
double
beta
=
0
)
const
;
void
assignTo
(
GpuMat
&
m
,
int
type
=-
1
)
const
;
//! sets every GpuMatrix element to s
GpuMat
&
operator
=
(
Scalar
s
);
//! sets some of the GpuMatrix elements to s, according to the mask
GpuMat
&
setTo
(
Scalar
s
,
const
GpuMat
&
mask
=
GpuMat
());
//! creates alternative GpuMatrix header for the same data, with different
// number of channels and/or different number of rows. see cvReshape.
GpuMat
reshape
(
int
cn
,
int
rows
=
0
)
const
;
//! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
// previous data is unreferenced if needed.
void
create
(
int
rows
,
int
cols
,
int
type
);
void
create
(
Size
size
,
int
type
);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
void
release
();
//! swaps with other smart pointer
void
swap
(
GpuMat
&
mat
);
//! locates GpuMatrix header within a parent GpuMatrix. See below
void
locateROI
(
Size
&
wholeSize
,
Point
&
ofs
)
const
;
//! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
GpuMat
&
adjustROI
(
int
dtop
,
int
dbottom
,
int
dleft
,
int
dright
);
//! extracts a rectangular sub-GpuMatrix
// (this is a generalized form of row, rowRange etc.)
GpuMat
operator
()(
Range
rowRange
,
Range
colRange
)
const
;
GpuMat
operator
()(
Rect
roi
)
const
;
//! returns true iff the GpuMatrix data is continuous
// (i.e. when there are no gaps between successive rows).
// similar to CV_IS_GpuMat_CONT(cvGpuMat->type)
bool
isContinuous
()
const
;
//! returns element size in bytes,
// similar to CV_ELEM_SIZE(cvMat->type)
size_t
elemSize
()
const
;
//! returns the size of element channel in bytes.
size_t
elemSize1
()
const
;
//! returns element type, similar to CV_MAT_TYPE(cvMat->type)
int
type
()
const
;
//! returns element type, similar to CV_MAT_DEPTH(cvMat->type)
int
depth
()
const
;
//! returns element type, similar to CV_MAT_CN(cvMat->type)
int
channels
()
const
;
//! returns step/elemSize1()
size_t
step1
()
const
;
//! returns GpuMatrix size:
// width == number of columns, height == number of rows
Size
size
()
const
;
//! returns true if GpuMatrix data is NULL
bool
empty
()
const
;
//! returns pointer to y-th row
uchar
*
ptr
(
int
y
=
0
);
const
uchar
*
ptr
(
int
y
=
0
)
const
;
//! template version of the above method
template
<
typename
_Tp
>
_Tp
*
ptr
(
int
y
=
0
);
template
<
typename
_Tp
>
const
_Tp
*
ptr
(
int
y
=
0
)
const
;
template
<
typename
_Tp
>
operator
PtrStepSz
<
_Tp
>
()
const
;
template
<
typename
_Tp
>
operator
PtrStep
<
_Tp
>
()
const
;
// Deprecated function
__CV_GPU_DEPR_BEFORE__
template
<
typename
_Tp
>
operator
DevMem2D_
<
_Tp
>
()
const
__CV_GPU_DEPR_AFTER__
;
#undef __CV_GPU_DEPR_BEFORE__
#undef __CV_GPU_DEPR_AFTER__
/*! includes several bit-fields:
- the magic signature
- continuity flag
- depth
- number of channels
*/
int
flags
;
//! the number of rows and columns
int
rows
,
cols
;
//! a distance between successive rows in bytes; includes the gap if any
size_t
step
;
//! pointer to the data
uchar
*
data
;
//! pointer to the reference counter;
// when GpuMatrix points to user-allocated data, the pointer is NULL
int
*
refcount
;
//! helper fields used in locateROI and adjustROI
uchar
*
datastart
;
uchar
*
dataend
;
};
//! Creates continuous GPU matrix
CV_EXPORTS
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
);
CV_EXPORTS
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
Size
size
,
int
type
);
//! Ensures that size of the given matrix is not less than (rows, cols) size
//! and matrix type is match specified one too
CV_EXPORTS
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
allocMatFromBuf
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
mat
);
////////////////////////////////////////////////////////////////////////
// Error handling
CV_EXPORTS
void
error
(
const
char
*
error_string
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
inline
GpuMat
::
GpuMat
()
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
}
CV_EXPORTS
void
printCudaDeviceInfo
(
int
device
);
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
create
(
rows_
,
cols_
,
type_
);
}
CV_EXPORTS
void
printShortCudaDeviceInfo
(
int
device
);
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
//////////////////////////////// GpuMat ///////////////////////////////
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
{
create
(
rows_
,
cols_
,
type_
);
setTo
(
s_
);
}
}
//! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
class
CV_EXPORTS
GpuMat
{
public:
//! default constructor
GpuMat
();
//! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
GpuMat
(
int
rows
,
int
cols
,
int
type
);
GpuMat
(
Size
size
,
int
type
);
//! constucts GpuMatrix and fills it with the specified value _s.
GpuMat
(
int
rows
,
int
cols
,
int
type
,
Scalar
s
);
GpuMat
(
Size
size
,
int
type
,
Scalar
s
);
//! copy constructor
GpuMat
(
const
GpuMat
&
m
);
//! constructor for GpuMatrix headers pointing to user-allocated data
GpuMat
(
int
rows
,
int
cols
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
GpuMat
(
Size
size
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
//! creates a matrix header for a part of the bigger matrix
GpuMat
(
const
GpuMat
&
m
,
Range
rowRange
,
Range
colRange
);
GpuMat
(
const
GpuMat
&
m
,
Rect
roi
);
//! builds GpuMat from Mat. Perfom blocking upload to device.
explicit
GpuMat
(
const
Mat
&
m
);
//! destructor - calls release()
~
GpuMat
();
//! assignment operators
GpuMat
&
operator
=
(
const
GpuMat
&
m
);
//! pefroms blocking upload data to GpuMat.
void
upload
(
const
Mat
&
m
);
//! downloads data from device to host memory. Blocking calls.
void
download
(
Mat
&
m
)
const
;
//! returns a new GpuMatrix header for the specified row
GpuMat
row
(
int
y
)
const
;
//! returns a new GpuMatrix header for the specified column
GpuMat
col
(
int
x
)
const
;
//! ... for the specified row span
GpuMat
rowRange
(
int
startrow
,
int
endrow
)
const
;
GpuMat
rowRange
(
Range
r
)
const
;
//! ... for the specified column span
GpuMat
colRange
(
int
startcol
,
int
endcol
)
const
;
GpuMat
colRange
(
Range
r
)
const
;
//! returns deep copy of the GpuMatrix, i.e. the data is copied
GpuMat
clone
()
const
;
//! copies the GpuMatrix content to "m".
// It calls m.create(this->size(), this->type()).
void
copyTo
(
GpuMat
&
m
)
const
;
//! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
void
copyTo
(
GpuMat
&
m
,
const
GpuMat
&
mask
)
const
;
//! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
void
convertTo
(
GpuMat
&
m
,
int
rtype
,
double
alpha
=
1
,
double
beta
=
0
)
const
;
void
assignTo
(
GpuMat
&
m
,
int
type
=-
1
)
const
;
//! sets every GpuMatrix element to s
GpuMat
&
operator
=
(
Scalar
s
);
//! sets some of the GpuMatrix elements to s, according to the mask
GpuMat
&
setTo
(
Scalar
s
,
const
GpuMat
&
mask
=
GpuMat
());
//! creates alternative GpuMatrix header for the same data, with different
// number of channels and/or different number of rows. see cvReshape.
GpuMat
reshape
(
int
cn
,
int
rows
=
0
)
const
;
//! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
// previous data is unreferenced if needed.
void
create
(
int
rows
,
int
cols
,
int
type
);
void
create
(
Size
size
,
int
type
);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
void
release
();
//! swaps with other smart pointer
void
swap
(
GpuMat
&
mat
);
//! locates GpuMatrix header within a parent GpuMatrix. See below
void
locateROI
(
Size
&
wholeSize
,
Point
&
ofs
)
const
;
//! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
GpuMat
&
adjustROI
(
int
dtop
,
int
dbottom
,
int
dleft
,
int
dright
);
//! extracts a rectangular sub-GpuMatrix
// (this is a generalized form of row, rowRange etc.)
GpuMat
operator
()(
Range
rowRange
,
Range
colRange
)
const
;
GpuMat
operator
()(
Rect
roi
)
const
;
//! returns true iff the GpuMatrix data is continuous
// (i.e. when there are no gaps between successive rows).
// similar to CV_IS_GpuMat_CONT(cvGpuMat->type)
bool
isContinuous
()
const
;
//! returns element size in bytes,
// similar to CV_ELEM_SIZE(cvMat->type)
size_t
elemSize
()
const
;
//! returns the size of element channel in bytes.
size_t
elemSize1
()
const
;
//! returns element type, similar to CV_MAT_TYPE(cvMat->type)
int
type
()
const
;
//! returns element type, similar to CV_MAT_DEPTH(cvMat->type)
int
depth
()
const
;
//! returns element type, similar to CV_MAT_CN(cvMat->type)
int
channels
()
const
;
//! returns step/elemSize1()
size_t
step1
()
const
;
//! returns GpuMatrix size:
// width == number of columns, height == number of rows
Size
size
()
const
;
//! returns true if GpuMatrix data is NULL
bool
empty
()
const
;
//! returns pointer to y-th row
uchar
*
ptr
(
int
y
=
0
);
const
uchar
*
ptr
(
int
y
=
0
)
const
;
//! template version of the above method
template
<
typename
_Tp
>
_Tp
*
ptr
(
int
y
=
0
);
template
<
typename
_Tp
>
const
_Tp
*
ptr
(
int
y
=
0
)
const
;
template
<
typename
_Tp
>
operator
PtrStepSz
<
_Tp
>
()
const
;
template
<
typename
_Tp
>
operator
PtrStep
<
_Tp
>
()
const
;
// Deprecated function
__CV_GPU_DEPR_BEFORE__
template
<
typename
_Tp
>
operator
DevMem2D_
<
_Tp
>
()
const
__CV_GPU_DEPR_AFTER__
;
#undef __CV_GPU_DEPR_BEFORE__
#undef __CV_GPU_DEPR_AFTER__
/*! includes several bit-fields:
- the magic signature
- continuity flag
- depth
- number of channels
*/
int
flags
;
//! the number of rows and columns
int
rows
,
cols
;
//! a distance between successive rows in bytes; includes the gap if any
size_t
step
;
//! pointer to the data
uchar
*
data
;
//! pointer to the reference counter;
// when GpuMatrix points to user-allocated data, the pointer is NULL
int
*
refcount
;
//! helper fields used in locateROI and adjustROI
uchar
*
datastart
;
uchar
*
dataend
;
};
//! Creates continuous GPU matrix
CV_EXPORTS
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
//! Ensures that size of the given matrix is not less than (rows, cols) size
//! and matrix type is match specified one too
CV_EXPORTS
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
allocMatFromBuf
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
mat
);
////////////////////////////////////////////////////////////////////////
// Error handling
CV_EXPORTS
void
error
(
const
char
*
error_string
,
const
char
*
file
,
const
int
line
,
const
char
*
func
=
""
);
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
inline
GpuMat
::
GpuMat
()
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{}
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
create
(
rows_
,
cols_
,
type_
);
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
::~
GpuMat
()
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
{
release
();
create
(
rows_
,
cols_
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
GpuMat
::
clone
()
const
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
{
GpuMat
m
;
copyTo
(
m
);
return
m
;
create
(
size_
.
height
,
size_
.
width
,
type_
);
setTo
(
s_
);
}
}
inline
void
GpuMat
::
assignTo
(
GpuMat
&
m
,
int
_type
)
const
{
if
(
_type
<
0
)
m
=
*
this
;
else
convertTo
(
m
,
_type
);
}
inline
GpuMat
::~
GpuMat
()
{
release
();
}
inline
size_t
GpuMat
::
step1
()
const
{
return
step
/
elemSize1
();
}
inline
GpuMat
GpuMat
::
clone
()
const
{
GpuMat
m
;
copyTo
(
m
);
return
m
;
}
inline
bool
GpuMat
::
empty
()
const
{
return
data
==
0
;
}
inline
void
GpuMat
::
assignTo
(
GpuMat
&
m
,
int
_type
)
const
{
if
(
_type
<
0
)
m
=
*
this
;
else
convertTo
(
m
,
_type
);
}
inline
size_t
GpuMat
::
step1
()
const
{
return
step
/
elemSize1
();
}
template
<
typename
_Tp
>
inline
_Tp
*
GpuMat
::
ptr
(
int
y
)
{
return
(
_Tp
*
)
ptr
(
y
);
}
inline
bool
GpuMat
::
empty
()
const
{
return
data
==
0
;
}
template
<
typename
_Tp
>
inline
const
_Tp
*
GpuMat
::
ptr
(
int
y
)
const
{
return
(
const
_Tp
*
)
ptr
(
y
);
}
template
<
typename
_Tp
>
inline
_Tp
*
GpuMat
::
ptr
(
int
y
)
{
return
(
_Tp
*
)
ptr
(
y
);
}
inline
void
swap
(
GpuMat
&
a
,
GpuMat
&
b
)
{
a
.
swap
(
b
);
}
template
<
typename
_Tp
>
inline
const
_Tp
*
GpuMat
::
ptr
(
int
y
)
const
{
return
(
const
_Tp
*
)
ptr
(
y
);
}
inline
GpuMat
GpuMat
::
row
(
int
y
)
const
{
return
GpuMat
(
*
this
,
Range
(
y
,
y
+
1
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
row
(
int
y
)
const
{
return
GpuMat
(
*
this
,
Range
(
y
,
y
+
1
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
col
(
int
x
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
x
,
x
+
1
));
}
inline
GpuMat
GpuMat
::
col
(
int
x
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
x
,
x
+
1
));
}
inline
GpuMat
GpuMat
::
rowRange
(
int
startrow
,
int
endrow
)
const
{
return
GpuMat
(
*
this
,
Range
(
startrow
,
endrow
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
rowRange
(
int
startrow
,
int
endrow
)
const
{
return
GpuMat
(
*
this
,
Range
(
startrow
,
endrow
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
rowRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
r
,
Range
::
all
());
}
inline
GpuMat
GpuMat
::
rowRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
r
,
Range
::
all
());
}
inline
GpuMat
GpuMat
::
colRange
(
int
startcol
,
int
endcol
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
startcol
,
endcol
));
}
inline
GpuMat
GpuMat
::
colRange
(
int
startcol
,
int
endcol
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
startcol
,
endcol
));
}
inline
GpuMat
GpuMat
::
colRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
r
);
}
inline
GpuMat
GpuMat
::
colRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
r
);
}
inline
void
GpuMat
::
create
(
Size
size_
,
int
type_
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
void
GpuMat
::
create
(
Size
size_
,
int
type_
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
GpuMat
::
operator
()(
Range
_rowRange
,
Range
_colRange
)
const
{
return
GpuMat
(
*
this
,
_rowRange
,
_colRange
);
}
inline
GpuMat
GpuMat
::
operator
()(
Range
_rowRange
,
Range
_colRange
)
const
{
return
GpuMat
(
*
this
,
_rowRange
,
_colRange
);
}
inline
GpuMat
GpuMat
::
operator
()(
Rect
roi
)
const
{
return
GpuMat
(
*
this
,
roi
);
}
inline
GpuMat
GpuMat
::
operator
()(
Rect
roi
)
const
{
return
GpuMat
(
*
this
,
roi
);
}
inline
bool
GpuMat
::
isContinuous
()
const
{
return
(
flags
&
Mat
::
CONTINUOUS_FLAG
)
!=
0
;
}
inline
bool
GpuMat
::
isContinuous
()
const
{
return
(
flags
&
Mat
::
CONTINUOUS_FLAG
)
!=
0
;
}
inline
size_t
GpuMat
::
elemSize
()
const
{
return
CV_ELEM_SIZE
(
flags
);
}
inline
size_t
GpuMat
::
elemSize
()
const
{
return
CV_ELEM_SIZE
(
flags
);
}
inline
size_t
GpuMat
::
elemSize1
()
const
{
return
CV_ELEM_SIZE1
(
flags
);
}
inline
size_t
GpuMat
::
elemSize1
()
const
{
return
CV_ELEM_SIZE1
(
flags
);
}
inline
int
GpuMat
::
type
()
const
{
return
CV_MAT_TYPE
(
flags
);
}
inline
int
GpuMat
::
type
()
const
{
return
CV_MAT_TYPE
(
flags
);
}
inline
int
GpuMat
::
depth
()
const
{
return
CV_MAT_DEPTH
(
flags
);
}
inline
int
GpuMat
::
depth
()
const
{
return
CV_MAT_DEPTH
(
flags
);
}
inline
int
GpuMat
::
channels
()
const
{
return
CV_MAT_CN
(
flags
);
}
inline
int
GpuMat
::
channels
()
const
{
return
CV_MAT_CN
(
flags
);
}
inline
Size
GpuMat
::
size
()
const
{
return
Size
(
cols
,
rows
);
}
inline
Size
GpuMat
::
size
()
const
{
return
Size
(
cols
,
rows
);
}
inline
uchar
*
GpuMat
::
ptr
(
int
y
)
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
uchar
*
GpuMat
::
ptr
(
int
y
)
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
const
uchar
*
GpuMat
::
ptr
(
int
y
)
const
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
const
uchar
*
GpuMat
::
ptr
(
int
y
)
const
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
GpuMat
&
GpuMat
::
operator
=
(
Scalar
s
)
{
setTo
(
s
);
return
*
this
;
}
inline
GpuMat
&
GpuMat
::
operator
=
(
Scalar
s
)
{
setTo
(
s
);
return
*
this
;
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStepSz
<
T
>
()
const
{
return
PtrStepSz
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStepSz
<
T
>
()
const
{
return
PtrStepSz
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStep
<
T
>
()
const
{
return
PtrStep
<
T
>
((
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStep
<
T
>
()
const
{
return
PtrStep
<
T
>
((
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
DevMem2D_
<
T
>
()
const
{
return
DevMem2D_
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
DevMem2D_
<
T
>
()
const
{
return
DevMem2D_
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
inline
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
)
{
GpuMat
m
;
createContinuous
(
rows
,
cols
,
type
,
m
);
return
m
;
}
static
inline
void
swap
(
GpuMat
&
a
,
GpuMat
&
b
)
{
a
.
swap
(
b
);
}
inline
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
createContinuous
(
size
.
height
,
size
.
width
,
type
,
m
);
}
static
inline
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
)
{
GpuMat
m
;
createContinuous
(
rows
,
cols
,
type
,
m
);
return
m
;
}
inline
GpuMat
createContinuous
(
Size
size
,
int
type
)
{
GpuMat
m
;
createContinuous
(
size
,
type
,
m
);
return
m
;
}
static
inline
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
createContinuous
(
size
.
height
,
size
.
width
,
type
,
m
);
}
inline
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
ensureSizeIsEnough
(
size
.
height
,
size
.
width
,
type
,
m
);
}
}}
static
inline
GpuMat
createContinuous
(
Size
size
,
int
type
)
{
GpuMat
m
;
createContinuous
(
size
,
type
,
m
);
return
m
;
}
static
inline
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
ensureSizeIsEnough
(
size
.
height
,
size
.
width
,
type
,
m
);
}
#endif // __cplusplus
}}
// cv::gpu
#endif // __OPENCV_GPUMAT_HPP__
modules/core/include/opencv2/core/mat.inl.hpp
浏览文件 @
940eedfb
...
...
@@ -47,11 +47,6 @@
# error mat.inl.hpp header must be compiled as C++
#endif
#ifndef SKIP_INCLUDES
#include <limits.h>
#include <string.h>
#endif // SKIP_INCLUDES
namespace
cv
{
...
...
modules/core/include/opencv2/core/opengl.hpp
浏览文件 @
940eedfb
...
...
@@ -43,8 +43,6 @@
#ifndef __OPENCV_OPENGL_INTEROP_HPP__
#define __OPENCV_OPENGL_INTEROP_HPP__
#ifdef __cplusplus
#include "opencv2/core.hpp"
namespace
cv
{
namespace
ogl
{
...
...
@@ -269,7 +267,7 @@ namespace cv { namespace gpu {
//! set a CUDA device to use OpenGL interoperability
CV_EXPORTS
void
setGlDevice
(
int
device
=
0
);
}}
}}
// cv::gpu
namespace
cv
{
...
...
@@ -278,6 +276,4 @@ template <> CV_EXPORTS void Ptr<cv::ogl::Texture2D::Impl>::delete_obj();
}
#endif // __cplusplus
#endif // __OPENCV_OPENGL_INTEROP_HPP__
modules/core/include/opencv2/core/operations.hpp
浏览文件 @
940eedfb
...
...
@@ -47,12 +47,7 @@
# error operations.hpp header must be compiled as C++
#endif
#ifndef SKIP_INCLUDES
#include <string.h>
#include <limits.h>
#endif // SKIP_INCLUDES
#include <limits>
#include <cstdio>
namespace
cv
{
...
...
@@ -356,6 +351,7 @@ inline unsigned RNG::next()
}
///////////////////////////////////////// LineIterator ////////////////////////////////////////
inline
...
...
@@ -398,39 +394,8 @@ template<typename _Tp> static inline _Tp randu()
}
//////////////////////////////////////////////////////////////////////////////
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
);
};
///////////////////////////////// Formatted output of cv::Mat /////////////////////////////////
static
inline
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
());
}
static
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
Ptr
<
Formatted
>
fmtd
)
int
print
(
Ptr
<
Formatted
>
fmtd
,
FILE
*
stream
=
stdout
)
{
int
written
=
0
;
fmtd
->
reset
();
for
(
const
char
*
str
=
fmtd
->
next
();
str
;
str
=
fmtd
->
next
())
out
<<
str
;
return
out
;
written
+=
fputs
(
str
,
stream
);
return
written
;
}
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
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
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
);
}
/** Writes a Matx to an output stream.
*/
template
<
typename
_Tp
,
int
m
,
int
n
>
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Matx
<
_Tp
,
m
,
n
>&
matx
)
template
<
typename
_Tp
,
int
m
,
int
n
>
static
inline
int
print
(
const
Matx
<
_Tp
,
m
,
n
>&
matx
,
FILE
*
stream
=
stdout
)
{
return
out
<<
Formatter
::
get
()
->
format
(
matx
);
}
/** 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
;
return
print
(
Formatter
::
get
()
->
format
(
matx
),
stream
);
}
////////////////////////////////////////// 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
>
();
}
template
<
typename
_Tp
>
inline
void
Algorithm
::
set
(
const
char
*
_name
,
const
Ptr
<
_Tp
>&
value
)
template
<
typename
_Tp
>
inline
void
Algorithm
::
set
(
const
char
*
_name
,
const
Ptr
<
_Tp
>&
value
)
{
Ptr
<
Algorithm
>
algo_ptr
=
value
.
template
ptr
<
cv
::
Algorithm
>();
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
);
}
template
<
typename
_Tp
>
inline
void
Algorithm
::
set
(
const
String
&
_name
,
const
Ptr
<
_Tp
>&
value
)
template
<
typename
_Tp
>
inline
void
Algorithm
::
set
(
const
String
&
_name
,
const
Ptr
<
_Tp
>&
value
)
{
this
->
set
<
_Tp
>
(
_name
.
c_str
(),
value
);
}
template
<
typename
_Tp
>
inline
void
Algorithm
::
setAlgorithm
(
const
char
*
_name
,
const
Ptr
<
_Tp
>&
value
)
template
<
typename
_Tp
>
inline
void
Algorithm
::
setAlgorithm
(
const
char
*
_name
,
const
Ptr
<
_Tp
>&
value
)
{
Ptr
<
Algorithm
>
algo_ptr
=
value
.
template
ptr
<
cv
::
Algorithm
>();
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
);
}
template
<
typename
_Tp
>
inline
void
Algorithm
::
setAlgorithm
(
const
String
&
_name
,
const
Ptr
<
_Tp
>&
value
)
template
<
typename
_Tp
>
inline
void
Algorithm
::
setAlgorithm
(
const
String
&
_name
,
const
Ptr
<
_Tp
>&
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
;
info
()
->
get
(
this
,
_name
.
c_str
(),
ParamType
<
_Tp
>::
type
,
&
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
;
info
()
->
get
(
this
,
_name
,
ParamType
<
_Tp
>::
type
,
&
value
);
return
value
;
}
template
<
typename
_Tp
,
typename
_Base
>
inline
void
AlgorithmInfo
::
addParam
(
Algorithm
&
algo
,
const
char
*
parameter
,
Ptr
<
_Tp
>&
value
,
bool
readOnly
,
Ptr
<
_Tp
>
(
Algorithm
::*
getter
)(),
void
(
Algorithm
::*
setter
)(
const
Ptr
<
_Tp
>&
),
const
String
&
help
)
template
<
typename
_Tp
,
typename
_Base
>
inline
void
AlgorithmInfo
::
addParam
(
Algorithm
&
algo
,
const
char
*
parameter
,
Ptr
<
_Tp
>&
value
,
bool
readOnly
,
Ptr
<
_Tp
>
(
Algorithm
::*
getter
)(),
void
(
Algorithm
::*
setter
)(
const
Ptr
<
_Tp
>&
),
const
String
&
help
)
{
//TODO: static assert: _Tp inherits from _Base
addParam_
(
algo
,
parameter
,
ParamType
<
_Base
>::
type
,
&
value
,
readOnly
,
(
Algorithm
::
Getter
)
getter
,
(
Algorithm
::
Setter
)
setter
,
help
);
}
template
<
typename
_Tp
>
inline
void
AlgorithmInfo
::
addParam
(
Algorithm
&
algo
,
const
char
*
parameter
,
Ptr
<
_Tp
>&
value
,
bool
readOnly
,
Ptr
<
_Tp
>
(
Algorithm
::*
getter
)(),
void
(
Algorithm
::*
setter
)(
const
Ptr
<
_Tp
>&
),
const
String
&
help
)
template
<
typename
_Tp
>
inline
void
AlgorithmInfo
::
addParam
(
Algorithm
&
algo
,
const
char
*
parameter
,
Ptr
<
_Tp
>&
value
,
bool
readOnly
,
Ptr
<
_Tp
>
(
Algorithm
::*
getter
)(),
void
(
Algorithm
::*
setter
)(
const
Ptr
<
_Tp
>&
),
const
String
&
help
)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_
(
algo
,
parameter
,
ParamType
<
Algorithm
>::
type
,
&
value
,
readOnly
,
(
Algorithm
::
Getter
)
getter
,
(
Algorithm
::
Setter
)
setter
,
help
);
}
}
}
// cv
#endif
modules/core/include/opencv2/core/persistence.hpp
浏览文件 @
940eedfb
...
...
@@ -226,6 +226,8 @@ public:
int
state
;
//!< the writer state
};
template
<
>
CV_EXPORTS
void
Ptr
<
CvFileStorage
>::
delete_obj
();
/*!
File Storage Node class
...
...
modules/core/include/opencv2/core/private.hpp
浏览文件 @
940eedfb
...
...
@@ -171,7 +171,7 @@ namespace cv
#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))
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
);
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
;
}
#ifdef IPL_DEPTH_8U
static
inline
cv
::
Size
cvGetMatSize
(
const
CvMat
*
mat
)
{
return
cv
::
Size
(
mat
->
cols
,
mat
->
rows
);
}
#endif
namespace
cv
{
...
...
modules/core/include/opencv2/core/traits.hpp
浏览文件 @
940eedfb
...
...
@@ -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
>
{
...
...
modules/core/include/opencv2/core/types_c.h
浏览文件 @
940eedfb
...
...
@@ -12,6 +12,7 @@
//
// Copyright (C) 2000-2008, Intel Corporation, 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.
//
// Redistribution and use in source and binary forms, with or without modification,
...
...
modules/core/src/command_line_parser.cpp
浏览文件 @
940eedfb
#include "precomp.hpp"
#include <sstream>
namespace
cv
{
...
...
modules/core/src/out.cpp
浏览文件 @
940eedfb
...
...
@@ -55,7 +55,7 @@ namespace
char
buf
[
32
];
// enough for double with precision up to 20
cv
::
Mat
mtx
;
int
mcn
;
int
mcn
;
// == mtx.channels()
bool
singleLine
;
int
state
;
...
...
@@ -68,7 +68,6 @@ namespace
char
braces
[
5
];
void
(
FormattedImpl
::*
valueToStr
)();
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
valueToStr16u
()
{
sprintf
(
buf
,
"%d"
,
(
int
)
mtx
.
ptr
<
ushort
>
(
row
,
col
)[
cn
]);
}
...
...
modules/core/test/test_mat.cpp
浏览文件 @
940eedfb
#include "test_precomp.hpp"
#include <map>
using
namespace
cv
;
using
namespace
std
;
...
...
modules/flann/src/miniflann.cpp
浏览文件 @
940eedfb
...
...
@@ -312,9 +312,9 @@ buildIndex_(void*& index, const Mat& data, const IndexParams& params, const Dist
{
typedef
typename
Distance
::
ElementType
ElementType
;
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
())
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
);
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
;
#endif
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
;
#endif
default:
CV_Error
(
CV_
StsBadArg
,
"Unknown/unsupported distance type"
);
CV_Error
(
Error
::
StsBadArg
,
"Unknown/unsupported distance type"
);
}
index
=
0
;
}
...
...
@@ -585,7 +585,7 @@ void Index::knnSearch(InputArray _query, OutputArray _indices,
break
;
#endif
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
);
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
)
{
...
...
@@ -623,7 +623,7 @@ int Index::radiusSearch(InputArray _query, OutputArray _indices,
return
runRadiusSearch
<
::
cvflann
::
KL_Divergence
<
float
>
>
(
index
,
query
,
indices
,
dists
,
radius
,
params
);
#endif
default:
CV_Error
(
CV_
StsBadArg
,
"Unknown/unsupported distance type"
);
CV_Error
(
Error
::
StsBadArg
,
"Unknown/unsupported distance type"
);
}
return
-
1
;
}
...
...
@@ -658,7 +658,7 @@ void Index::save(const String& filename) const
{
FILE
*
fout
=
fopen
(
filename
.
c_str
(),
"wb"
);
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
)
{
...
...
@@ -691,7 +691,7 @@ void Index::save(const String& filename) const
default:
fclose
(
fout
);
fout
=
0
;
CV_Error
(
CV_
StsBadArg
,
"Unknown/unsupported distance type"
);
CV_Error
(
Error
::
StsBadArg
,
"Unknown/unsupported distance type"
);
}
if
(
fout
)
fclose
(
fout
);
...
...
modules/java/generator/src/cpp/Mat.cpp
浏览文件 @
940eedfb
...
...
@@ -2543,12 +2543,35 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
(
JNIEnv
*
env
,
jclass
,
jlong
self
)
{
cv
::
Mat
*
me
=
(
cv
::
Mat
*
)
self
;
//TODO: check for NULL
std
::
stringstream
s
;
try
{
LOGD
(
"Mat::nDump()"
);
s
<<
*
me
;
return
env
->
NewStringUTF
(
s
.
str
().
c_str
());
const
int
BUFSZ
=
4096
-
32
;
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
)
{
LOGE
(
"Mat::nDump() catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
env
->
FindClass
(
"org/opencv/core/CvException"
);
...
...
modules/softcascade/include/opencv2/softcascade.hpp
浏览文件 @
940eedfb
...
...
@@ -45,6 +45,7 @@
#include "opencv2/core.hpp"
#include "opencv2/core/gpumat.hpp"
#include <ostream>
namespace
cv
{
namespace
softcascade
{
...
...
modules/softcascade/src/integral_channel_builder.cpp
浏览文件 @
940eedfb
...
...
@@ -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
)
{
out
<<
m
.
channel
<<
" "
<<
m
.
bb
;
return
out
;
return
out
<<
m
.
channel
<<
" "
<<
"["
<<
m
.
bb
.
width
<<
" x "
<<
m
.
bb
.
height
<<
" from ("
<<
m
.
bb
.
x
<<
", "
<<
m
.
bb
.
y
<<
")]"
;
}
ChannelFeature
::~
ChannelFeature
(){}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录