Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
13b31b08
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,发现更多精彩内容 >>
提交
13b31b08
编写于
3月 26, 2013
作者:
A
Andrey Kamaev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move C++ basic structures to separate header and inverse dependency from C API
cv::Complex, cv::Point_ and cv::Point3_ are moved.
上级
19f8f85c
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
314 addition
and
251 deletion
+314
-251
modules/calib3d/src/calibinit.cpp
modules/calib3d/src/calibinit.cpp
+3
-3
modules/core/include/opencv2/core.hpp
modules/core/include/opencv2/core.hpp
+1
-126
modules/core/include/opencv2/core/operations.hpp
modules/core/include/opencv2/core/operations.hpp
+0
-91
modules/core/include/opencv2/core/types.hpp
modules/core/include/opencv2/core/types.hpp
+251
-0
modules/core/include/opencv2/core/types_c.h
modules/core/include/opencv2/core/types_c.h
+28
-0
modules/imgproc/src/contours.cpp
modules/imgproc/src/contours.cpp
+2
-2
modules/legacy/src/3dtracker.cpp
modules/legacy/src/3dtracker.cpp
+1
-1
modules/legacy/src/_vectrack.h
modules/legacy/src/_vectrack.h
+2
-2
modules/legacy/src/calibfilter.cpp
modules/legacy/src/calibfilter.cpp
+1
-1
modules/legacy/src/epilines.cpp
modules/legacy/src/epilines.cpp
+1
-1
modules/legacy/src/lcm.cpp
modules/legacy/src/lcm.cpp
+2
-2
modules/legacy/src/morphcontours.cpp
modules/legacy/src/morphcontours.cpp
+2
-2
modules/legacy/src/segment.cpp
modules/legacy/src/segment.cpp
+3
-3
modules/legacy/src/vecfacetracking.cpp
modules/legacy/src/vecfacetracking.cpp
+10
-10
modules/legacy/test/test_pyrsegmentation.cpp
modules/legacy/test/test_pyrsegmentation.cpp
+2
-2
modules/ml/test/test_mltests2.cpp
modules/ml/test/test_mltests2.cpp
+1
-1
modules/objdetect/src/datamatrix.cpp
modules/objdetect/src/datamatrix.cpp
+2
-2
samples/c/find_obj.cpp
samples/c/find_obj.cpp
+1
-1
samples/cpp/letter_recog.cpp
samples/cpp/letter_recog.cpp
+1
-1
未找到文件。
modules/calib3d/src/calibinit.cpp
浏览文件 @
13b31b08
...
...
@@ -1095,7 +1095,7 @@ icvOrderQuad(CvCBQuad *quad, CvCBCorner *corner, int common)
static
int
icvCleanFoundConnectedQuads
(
int
quad_count
,
CvCBQuad
**
quad_group
,
CvSize
pattern_size
)
{
CvPoint2D32f
center
=
{
0
,
0
}
;
CvPoint2D32f
center
;
int
i
,
j
,
k
;
// number of quads this pattern should contain
int
count
=
((
pattern_size
.
width
+
1
)
*
(
pattern_size
.
height
+
1
)
+
1
)
/
2
;
...
...
@@ -1111,7 +1111,7 @@ icvCleanFoundConnectedQuads( int quad_count, CvCBQuad **quad_group, CvSize patte
for
(
i
=
0
;
i
<
quad_count
;
i
++
)
{
CvPoint2D32f
ci
=
{
0
,
0
}
;
CvPoint2D32f
ci
;
CvCBQuad
*
q
=
quad_group
[
i
];
for
(
j
=
0
;
j
<
4
;
j
++
)
...
...
@@ -1856,7 +1856,7 @@ cvDrawChessboardCorners( CvArr* _image, CvSize pattern_size,
else
{
int
x
,
y
;
CvPoint
prev_pt
=
{
0
,
0
}
;
CvPoint
prev_pt
;
const
int
line_max
=
7
;
static
const
CvScalar
line_colors
[
line_max
]
=
{
...
...
modules/core/include/opencv2/core.hpp
浏览文件 @
13b31b08
...
...
@@ -53,6 +53,7 @@
#ifdef __cplusplus
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/types.hpp"
#ifndef SKIP_INCLUDES
#include <limits.h>
...
...
@@ -523,125 +524,6 @@ typedef Vec<double, 4> Vec4d;
typedef
Vec
<
double
,
6
>
Vec6d
;
//////////////////////////////// Complex //////////////////////////////
/*!
A complex number class.
The template class is similar and compatible with std::complex, however it provides slightly
more convenient access to the real and imaginary parts using through the simple field access, as opposite
to std::complex::real() and std::complex::imag().
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Complex
{
public:
//! constructors
Complex
();
Complex
(
_Tp
_re
,
_Tp
_im
=
0
);
Complex
(
const
std
::
complex
<
_Tp
>&
c
);
//! conversion to another data type
template
<
typename
T2
>
operator
Complex
<
T2
>
()
const
;
//! conjugation
Complex
conj
()
const
;
//! conversion to std::complex
operator
std
::
complex
<
_Tp
>
()
const
;
_Tp
re
,
im
;
//< the real and the imaginary parts
};
/*!
\typedef
*/
typedef
Complex
<
float
>
Complexf
;
typedef
Complex
<
double
>
Complexd
;
//////////////////////////////// Point_ ////////////////////////////////
/*!
template 2D point class.
The class defines a point in 2D space. Data type of the point coordinates is specified
as a template parameter. There are a few shorter aliases available for user convenience.
See cv::Point, cv::Point2i, cv::Point2f and cv::Point2d.
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Point_
{
public:
typedef
_Tp
value_type
;
// various constructors
Point_
();
Point_
(
_Tp
_x
,
_Tp
_y
);
Point_
(
const
Point_
&
pt
);
Point_
(
const
CvPoint
&
pt
);
Point_
(
const
CvPoint2D32f
&
pt
);
Point_
(
const
Size_
<
_Tp
>&
sz
);
Point_
(
const
Vec
<
_Tp
,
2
>&
v
);
Point_
&
operator
=
(
const
Point_
&
pt
);
//! conversion to another data type
template
<
typename
_Tp2
>
operator
Point_
<
_Tp2
>
()
const
;
//! conversion to the old-style C structures
operator
CvPoint
()
const
;
operator
CvPoint2D32f
()
const
;
operator
Vec
<
_Tp
,
2
>
()
const
;
//! dot product
_Tp
dot
(
const
Point_
&
pt
)
const
;
//! dot product computed in double-precision arithmetics
double
ddot
(
const
Point_
&
pt
)
const
;
//! cross-product
double
cross
(
const
Point_
&
pt
)
const
;
//! checks whether the point is inside the specified rectangle
bool
inside
(
const
Rect_
<
_Tp
>&
r
)
const
;
_Tp
x
,
y
;
//< the point coordinates
};
/*!
template 3D point class.
The class defines a point in 3D space. Data type of the point coordinates is specified
as a template parameter.
\see cv::Point3i, cv::Point3f and cv::Point3d
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Point3_
{
public:
typedef
_Tp
value_type
;
// various constructors
Point3_
();
Point3_
(
_Tp
_x
,
_Tp
_y
,
_Tp
_z
);
Point3_
(
const
Point3_
&
pt
);
explicit
Point3_
(
const
Point_
<
_Tp
>&
pt
);
Point3_
(
const
CvPoint3D32f
&
pt
);
Point3_
(
const
Vec
<
_Tp
,
3
>&
v
);
Point3_
&
operator
=
(
const
Point3_
&
pt
);
//! conversion to another data type
template
<
typename
_Tp2
>
operator
Point3_
<
_Tp2
>
()
const
;
//! conversion to the old-style CvPoint...
operator
CvPoint3D32f
()
const
;
//! conversion to cv::Vec<>
operator
Vec
<
_Tp
,
3
>
()
const
;
//! dot product
_Tp
dot
(
const
Point3_
&
pt
)
const
;
//! dot product computed in double-precision arithmetics
double
ddot
(
const
Point3_
&
pt
)
const
;
//! cross product of the 2 3D points
Point3_
cross
(
const
Point3_
&
pt
)
const
;
_Tp
x
,
y
,
z
;
//< the point coordinates
};
//////////////////////////////// Size_ ////////////////////////////////
/*!
...
...
@@ -726,17 +608,10 @@ public:
shorter aliases for the most popular cv::Point_<>, cv::Size_<> and cv::Rect_<> specializations
*/
typedef
Point_
<
int
>
Point2i
;
typedef
Point2i
Point
;
typedef
Size_
<
int
>
Size2i
;
typedef
Size2i
Size
;
typedef
Rect_
<
int
>
Rect
;
typedef
Point_
<
float
>
Point2f
;
typedef
Point_
<
double
>
Point2d
;
typedef
Size_
<
float
>
Size2f
;
typedef
Point3_
<
int
>
Point3i
;
typedef
Point3_
<
float
>
Point3f
;
typedef
Point3_
<
double
>
Point3d
;
/*!
...
...
modules/core/include/opencv2/core/operations.hpp
浏览文件 @
13b31b08
...
...
@@ -98,85 +98,6 @@
namespace
cv
{
/////////////// saturate_cast (used in image & signal processing) ///////////////////
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
uchar
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
schar
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
ushort
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
short
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
unsigned
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
int
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
float
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
double
v
)
{
return
_Tp
(
v
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
schar
v
)
{
return
(
uchar
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
ushort
v
)
{
return
(
uchar
)
std
::
min
((
unsigned
)
v
,
(
unsigned
)
UCHAR_MAX
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
int
v
)
{
return
(
uchar
)((
unsigned
)
v
<=
UCHAR_MAX
?
v
:
v
>
0
?
UCHAR_MAX
:
0
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
short
v
)
{
return
saturate_cast
<
uchar
>
((
int
)
v
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
unsigned
v
)
{
return
(
uchar
)
std
::
min
(
v
,
(
unsigned
)
UCHAR_MAX
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
uchar
>
(
iv
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
uchar
>
(
iv
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
uchar
v
)
{
return
(
schar
)
std
::
min
((
int
)
v
,
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
ushort
v
)
{
return
(
schar
)
std
::
min
((
unsigned
)
v
,
(
unsigned
)
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
int
v
)
{
return
(
schar
)((
unsigned
)(
v
-
SCHAR_MIN
)
<=
(
unsigned
)
UCHAR_MAX
?
v
:
v
>
0
?
SCHAR_MAX
:
SCHAR_MIN
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
short
v
)
{
return
saturate_cast
<
schar
>
((
int
)
v
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
unsigned
v
)
{
return
(
schar
)
std
::
min
(
v
,
(
unsigned
)
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
schar
>
(
iv
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
schar
>
(
iv
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
schar
v
)
{
return
(
ushort
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
short
v
)
{
return
(
ushort
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
int
v
)
{
return
(
ushort
)((
unsigned
)
v
<=
(
unsigned
)
USHRT_MAX
?
v
:
v
>
0
?
USHRT_MAX
:
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
unsigned
v
)
{
return
(
ushort
)
std
::
min
(
v
,
(
unsigned
)
USHRT_MAX
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
ushort
>
(
iv
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
ushort
>
(
iv
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
ushort
v
)
{
return
(
short
)
std
::
min
((
int
)
v
,
SHRT_MAX
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
int
v
)
{
return
(
short
)((
unsigned
)(
v
-
SHRT_MIN
)
<=
(
unsigned
)
USHRT_MAX
?
v
:
v
>
0
?
SHRT_MAX
:
SHRT_MIN
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
unsigned
v
)
{
return
(
short
)
std
::
min
(
v
,
(
unsigned
)
SHRT_MAX
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
short
>
(
iv
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
short
>
(
iv
);
}
template
<
>
inline
int
saturate_cast
<
int
>
(
float
v
)
{
return
cvRound
(
v
);
}
template
<
>
inline
int
saturate_cast
<
int
>
(
double
v
)
{
return
cvRound
(
v
);
}
// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
template
<
>
inline
unsigned
saturate_cast
<
unsigned
>
(
float
v
){
return
cvRound
(
v
);
}
template
<
>
inline
unsigned
saturate_cast
<
unsigned
>
(
double
v
)
{
return
cvRound
(
v
);
}
inline
int
fast_abs
(
uchar
v
)
{
return
v
;
}
inline
int
fast_abs
(
schar
v
)
{
return
std
::
abs
((
int
)
v
);
}
inline
int
fast_abs
(
ushort
v
)
{
return
v
;
}
...
...
@@ -1605,9 +1526,6 @@ Complex<_Tp> operator /= (const Complex<_Tp>& a, _Tp b)
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
()
:
x
(
0
),
y
(
0
)
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
_Tp
_x
,
_Tp
_y
)
:
x
(
_x
),
y
(
_y
)
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
const
Point_
&
pt
)
:
x
(
pt
.
x
),
y
(
pt
.
y
)
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
const
CvPoint
&
pt
)
:
x
((
_Tp
)
pt
.
x
),
y
((
_Tp
)
pt
.
y
)
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
const
CvPoint2D32f
&
pt
)
:
x
(
saturate_cast
<
_Tp
>
(
pt
.
x
)),
y
(
saturate_cast
<
_Tp
>
(
pt
.
y
))
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
const
Size_
<
_Tp
>&
sz
)
:
x
(
sz
.
width
),
y
(
sz
.
height
)
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
Point_
(
const
Vec
<
_Tp
,
2
>&
v
)
:
x
(
v
[
0
]),
y
(
v
[
1
])
{}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>&
Point_
<
_Tp
>::
operator
=
(
const
Point_
&
pt
)
...
...
@@ -1615,10 +1533,6 @@ template<typename _Tp> inline Point_<_Tp>& Point_<_Tp>::operator = (const Point_
template
<
typename
_Tp
>
template
<
typename
_Tp2
>
inline
Point_
<
_Tp
>::
operator
Point_
<
_Tp2
>
()
const
{
return
Point_
<
_Tp2
>
(
saturate_cast
<
_Tp2
>
(
x
),
saturate_cast
<
_Tp2
>
(
y
));
}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
operator
CvPoint
()
const
{
return
cvPoint
(
saturate_cast
<
int
>
(
x
),
saturate_cast
<
int
>
(
y
));
}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
operator
CvPoint2D32f
()
const
{
return
cvPoint2D32f
((
float
)
x
,
(
float
)
y
);
}
template
<
typename
_Tp
>
inline
Point_
<
_Tp
>::
operator
Vec
<
_Tp
,
2
>
()
const
{
return
Vec
<
_Tp
,
2
>
(
x
,
y
);
}
...
...
@@ -1712,16 +1626,11 @@ template<typename _Tp> inline Point3_<_Tp>::Point3_() : x(0), y(0), z(0) {}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
Point3_
(
_Tp
_x
,
_Tp
_y
,
_Tp
_z
)
:
x
(
_x
),
y
(
_y
),
z
(
_z
)
{}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
Point3_
(
const
Point3_
&
pt
)
:
x
(
pt
.
x
),
y
(
pt
.
y
),
z
(
pt
.
z
)
{}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
Point3_
(
const
Point_
<
_Tp
>&
pt
)
:
x
(
pt
.
x
),
y
(
pt
.
y
),
z
(
_Tp
())
{}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
Point3_
(
const
CvPoint3D32f
&
pt
)
:
x
(
saturate_cast
<
_Tp
>
(
pt
.
x
)),
y
(
saturate_cast
<
_Tp
>
(
pt
.
y
)),
z
(
saturate_cast
<
_Tp
>
(
pt
.
z
))
{}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
Point3_
(
const
Vec
<
_Tp
,
3
>&
v
)
:
x
(
v
[
0
]),
y
(
v
[
1
]),
z
(
v
[
2
])
{}
template
<
typename
_Tp
>
template
<
typename
_Tp2
>
inline
Point3_
<
_Tp
>::
operator
Point3_
<
_Tp2
>
()
const
{
return
Point3_
<
_Tp2
>
(
saturate_cast
<
_Tp2
>
(
x
),
saturate_cast
<
_Tp2
>
(
y
),
saturate_cast
<
_Tp2
>
(
z
));
}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
operator
CvPoint3D32f
()
const
{
return
cvPoint3D32f
((
float
)
x
,
(
float
)
y
,
(
float
)
z
);
}
template
<
typename
_Tp
>
inline
Point3_
<
_Tp
>::
operator
Vec
<
_Tp
,
3
>
()
const
{
return
Vec
<
_Tp
,
3
>
(
x
,
y
,
z
);
}
...
...
modules/core/include/opencv2/core/types.hpp
0 → 100644
浏览文件 @
13b31b08
/*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_TYPES_HPP__
#define __OPENCV_CORE_TYPES_HPP__
#include <climits>
#ifndef OPENCV_NOSTL
# include <complex>
#endif
#include "opencv2/core/cvdef.h"
#include "opencv2/core/cvstd.hpp"
namespace
cv
{
template
<
typename
_Tp
>
class
CV_EXPORTS
Size_
;
template
<
typename
_Tp
>
class
CV_EXPORTS
Point_
;
template
<
typename
_Tp
>
class
CV_EXPORTS
Rect_
;
template
<
typename
_Tp
,
int
cn
>
class
CV_EXPORTS
Vec
;
//template<typename _Tp, int m, int n> class CV_EXPORTS Matx;
/////////////// saturate_cast (used in image & signal processing) ///////////////////
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
uchar
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
schar
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
ushort
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
short
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
unsigned
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
int
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
float
v
)
{
return
_Tp
(
v
);
}
template
<
typename
_Tp
>
static
inline
_Tp
saturate_cast
(
double
v
)
{
return
_Tp
(
v
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
schar
v
)
{
return
(
uchar
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
ushort
v
)
{
return
(
uchar
)
std
::
min
((
unsigned
)
v
,
(
unsigned
)
UCHAR_MAX
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
int
v
)
{
return
(
uchar
)((
unsigned
)
v
<=
UCHAR_MAX
?
v
:
v
>
0
?
UCHAR_MAX
:
0
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
short
v
)
{
return
saturate_cast
<
uchar
>
((
int
)
v
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
unsigned
v
)
{
return
(
uchar
)
std
::
min
(
v
,
(
unsigned
)
UCHAR_MAX
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
uchar
>
(
iv
);
}
template
<
>
inline
uchar
saturate_cast
<
uchar
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
uchar
>
(
iv
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
uchar
v
)
{
return
(
schar
)
std
::
min
((
int
)
v
,
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
ushort
v
)
{
return
(
schar
)
std
::
min
((
unsigned
)
v
,
(
unsigned
)
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
int
v
)
{
return
(
schar
)((
unsigned
)(
v
-
SCHAR_MIN
)
<=
(
unsigned
)
UCHAR_MAX
?
v
:
v
>
0
?
SCHAR_MAX
:
SCHAR_MIN
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
short
v
)
{
return
saturate_cast
<
schar
>
((
int
)
v
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
unsigned
v
)
{
return
(
schar
)
std
::
min
(
v
,
(
unsigned
)
SCHAR_MAX
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
schar
>
(
iv
);
}
template
<
>
inline
schar
saturate_cast
<
schar
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
schar
>
(
iv
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
schar
v
)
{
return
(
ushort
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
short
v
)
{
return
(
ushort
)
std
::
max
((
int
)
v
,
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
int
v
)
{
return
(
ushort
)((
unsigned
)
v
<=
(
unsigned
)
USHRT_MAX
?
v
:
v
>
0
?
USHRT_MAX
:
0
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
unsigned
v
)
{
return
(
ushort
)
std
::
min
(
v
,
(
unsigned
)
USHRT_MAX
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
ushort
>
(
iv
);
}
template
<
>
inline
ushort
saturate_cast
<
ushort
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
ushort
>
(
iv
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
ushort
v
)
{
return
(
short
)
std
::
min
((
int
)
v
,
SHRT_MAX
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
int
v
)
{
return
(
short
)((
unsigned
)(
v
-
SHRT_MIN
)
<=
(
unsigned
)
USHRT_MAX
?
v
:
v
>
0
?
SHRT_MAX
:
SHRT_MIN
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
unsigned
v
)
{
return
(
short
)
std
::
min
(
v
,
(
unsigned
)
SHRT_MAX
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
float
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
short
>
(
iv
);
}
template
<
>
inline
short
saturate_cast
<
short
>
(
double
v
)
{
int
iv
=
cvRound
(
v
);
return
saturate_cast
<
short
>
(
iv
);
}
template
<
>
inline
int
saturate_cast
<
int
>
(
float
v
)
{
return
cvRound
(
v
);
}
template
<
>
inline
int
saturate_cast
<
int
>
(
double
v
)
{
return
cvRound
(
v
);
}
// we intentionally do not clip negative numbers, to make -1 become 0xffffffff etc.
template
<
>
inline
unsigned
saturate_cast
<
unsigned
>
(
float
v
)
{
return
cvRound
(
v
);
}
template
<
>
inline
unsigned
saturate_cast
<
unsigned
>
(
double
v
)
{
return
cvRound
(
v
);
}
//////////////////////////////// Complex //////////////////////////////
/*!
A complex number class.
The template class is similar and compatible with std::complex, however it provides slightly
more convenient access to the real and imaginary parts using through the simple field access, as opposite
to std::complex::real() and std::complex::imag().
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Complex
{
public:
//! constructors
Complex
();
Complex
(
_Tp
_re
,
_Tp
_im
=
0
);
//! conversion to another data type
template
<
typename
T2
>
operator
Complex
<
T2
>
()
const
;
//! conjugation
Complex
conj
()
const
;
_Tp
re
,
im
;
//< the real and the imaginary parts
#ifndef OPENCV_NOSTL
Complex
(
const
std
::
complex
<
_Tp
>&
c
);
operator
std
::
complex
<
_Tp
>
()
const
;
#endif
};
/*!
\typedef
*/
typedef
Complex
<
float
>
Complexf
;
typedef
Complex
<
double
>
Complexd
;
//////////////////////////////// Point_ ////////////////////////////////
/*!
template 2D point class.
The class defines a point in 2D space. Data type of the point coordinates is specified
as a template parameter. There are a few shorter aliases available for user convenience.
See cv::Point, cv::Point2i, cv::Point2f and cv::Point2d.
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Point_
{
public:
typedef
_Tp
value_type
;
// various constructors
Point_
();
Point_
(
_Tp
_x
,
_Tp
_y
);
Point_
(
const
Point_
&
pt
);
Point_
(
const
Size_
<
_Tp
>&
sz
);
Point_
(
const
Vec
<
_Tp
,
2
>&
v
);
Point_
&
operator
=
(
const
Point_
&
pt
);
//! conversion to another data type
template
<
typename
_Tp2
>
operator
Point_
<
_Tp2
>
()
const
;
//! conversion to the old-style C structures
operator
Vec
<
_Tp
,
2
>
()
const
;
//! dot product
_Tp
dot
(
const
Point_
&
pt
)
const
;
//! dot product computed in double-precision arithmetics
double
ddot
(
const
Point_
&
pt
)
const
;
//! cross-product
double
cross
(
const
Point_
&
pt
)
const
;
//! checks whether the point is inside the specified rectangle
bool
inside
(
const
Rect_
<
_Tp
>&
r
)
const
;
_Tp
x
,
y
;
//< the point coordinates
};
/*!
\typedef
*/
typedef
Point_
<
int
>
Point2i
;
typedef
Point_
<
float
>
Point2f
;
typedef
Point_
<
double
>
Point2d
;
typedef
Point2i
Point
;
//////////////////////////////// Point3_ ////////////////////////////////
/*!
template 3D point class.
The class defines a point in 3D space. Data type of the point coordinates is specified
as a template parameter.
\see cv::Point3i, cv::Point3f and cv::Point3d
*/
template
<
typename
_Tp
>
class
CV_EXPORTS
Point3_
{
public:
typedef
_Tp
value_type
;
// various constructors
Point3_
();
Point3_
(
_Tp
_x
,
_Tp
_y
,
_Tp
_z
);
Point3_
(
const
Point3_
&
pt
);
explicit
Point3_
(
const
Point_
<
_Tp
>&
pt
);
Point3_
(
const
Vec
<
_Tp
,
3
>&
v
);
Point3_
&
operator
=
(
const
Point3_
&
pt
);
//! conversion to another data type
template
<
typename
_Tp2
>
operator
Point3_
<
_Tp2
>
()
const
;
//! conversion to cv::Vec<>
operator
Vec
<
_Tp
,
3
>
()
const
;
//! dot product
_Tp
dot
(
const
Point3_
&
pt
)
const
;
//! dot product computed in double-precision arithmetics
double
ddot
(
const
Point3_
&
pt
)
const
;
//! cross product of the 2 3D points
Point3_
cross
(
const
Point3_
&
pt
)
const
;
_Tp
x
,
y
,
z
;
//< the point coordinates
};
/*!
\typedef
*/
typedef
Point3_
<
int
>
Point3i
;
typedef
Point3_
<
float
>
Point3f
;
typedef
Point3_
<
double
>
Point3d
;
}
// cv
#endif //__OPENCV_CORE_TYPES_HPP__
\ No newline at end of file
modules/core/include/opencv2/core/types_c.h
浏览文件 @
13b31b08
...
...
@@ -92,6 +92,10 @@
# define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
#endif
#ifdef __cplusplus
# include "opencv2/core/types.hpp"
#endif
/* CvArr* is used to pass arbitrary
* array-like data structures
* into functions where the particular
...
...
@@ -749,6 +753,14 @@ typedef struct CvPoint
{
int
x
;
int
y
;
#ifdef __cplusplus
CvPoint
(
int
_x
=
0
,
int
_y
=
0
)
:
x
(
_x
),
y
(
_y
)
{}
template
<
typename
_Tp
>
CvPoint
(
const
cv
::
Point_
<
_Tp
>&
pt
)
:
x
((
int
)
pt
.
x
),
y
((
int
)
pt
.
y
)
{}
template
<
typename
_Tp
>
operator
cv
::
Point_
<
_Tp
>
()
const
{
return
cv
::
Point_
<
_Tp
>
(
cv
::
saturate_cast
<
_Tp
>
(
x
),
cv
::
saturate_cast
<
_Tp
>
(
y
));
}
#endif
}
CvPoint
;
...
...
@@ -768,6 +780,14 @@ typedef struct CvPoint2D32f
{
float
x
;
float
y
;
#ifdef __cplusplus
CvPoint2D32f
(
float
_x
=
0
,
float
_y
=
0
)
:
x
(
_x
),
y
(
_y
)
{}
template
<
typename
_Tp
>
CvPoint2D32f
(
const
cv
::
Point_
<
_Tp
>&
pt
)
:
x
((
float
)
pt
.
x
),
y
((
float
)
pt
.
y
)
{}
template
<
typename
_Tp
>
operator
cv
::
Point_
<
_Tp
>
()
const
{
return
cv
::
Point_
<
_Tp
>
(
cv
::
saturate_cast
<
_Tp
>
(
x
),
cv
::
saturate_cast
<
_Tp
>
(
y
));
}
#endif
}
CvPoint2D32f
;
...
...
@@ -804,6 +824,14 @@ typedef struct CvPoint3D32f
float
x
;
float
y
;
float
z
;
#ifdef __cplusplus
CvPoint3D32f
(
float
_x
=
0
,
float
_y
=
0
,
float
_z
=
0
)
:
x
(
_x
),
y
(
_y
),
z
(
_z
)
{}
template
<
typename
_Tp
>
CvPoint3D32f
(
const
cv
::
Point3_
<
_Tp
>&
pt
)
:
x
((
float
)
pt
.
x
),
y
((
float
)
pt
.
y
),
z
((
float
)
pt
.
z
)
{}
template
<
typename
_Tp
>
operator
cv
::
Point3_
<
_Tp
>
()
const
{
return
cv
::
Point3_
<
_Tp
>
(
cv
::
saturate_cast
<
_Tp
>
(
x
),
cv
::
saturate_cast
<
_Tp
>
(
y
),
cv
::
saturate_cast
<
_Tp
>
(
z
));
}
#endif
}
CvPoint3D32f
;
...
...
modules/imgproc/src/contours.cpp
浏览文件 @
13b31b08
...
...
@@ -48,7 +48,7 @@
(deltas)[6] = (step), (deltas)[7] = (step) + (nch))
static
const
CvPoint
icvCodeDeltas
[
8
]
=
{
{
1
,
0
},
{
1
,
-
1
},
{
0
,
-
1
},
{
-
1
,
-
1
},
{
-
1
,
0
},
{
-
1
,
1
},
{
0
,
1
},
{
1
,
1
}
};
{
CvPoint
(
1
,
0
),
CvPoint
(
1
,
-
1
),
CvPoint
(
0
,
-
1
),
CvPoint
(
-
1
,
-
1
),
CvPoint
(
-
1
,
0
),
CvPoint
(
-
1
,
1
),
CvPoint
(
0
,
1
),
CvPoint
(
1
,
1
)
};
CV_IMPL
void
cvStartReadChainPoints
(
CvChain
*
chain
,
CvChainPtReader
*
reader
)
...
...
@@ -78,7 +78,7 @@ cvReadChainPoint( CvChainPtReader * reader )
{
schar
*
ptr
;
int
code
;
CvPoint
pt
=
{
0
,
0
}
;
CvPoint
pt
;
if
(
!
reader
)
CV_Error
(
CV_StsNullPtr
,
""
);
...
...
modules/legacy/src/3dtracker.cpp
浏览文件 @
13b31b08
...
...
@@ -321,7 +321,7 @@ static void DrawEtalon(IplImage *img, CvPoint2D32f *corners,
const
int
r
=
4
;
int
i
;
int
x
,
y
;
CvPoint
prev_pt
=
{
0
,
0
}
;
CvPoint
prev_pt
;
static
const
CvScalar
rgb_colors
[]
=
{
{{
0
,
0
,
255
}},
{{
0
,
128
,
255
}},
...
...
modules/legacy/src/_vectrack.h
浏览文件 @
13b31b08
...
...
@@ -87,8 +87,8 @@ int PointInRect(const CvPoint& p, const CvRect& r)
inline
int
RectInRect
(
const
CvRect
&
r1
,
const
CvRect
&
r2
)
{
CvPoint
plt
=
{
r1
.
x
,
r1
.
y
}
;
CvPoint
prb
=
{
r1
.
x
+
r1
.
width
,
r1
.
y
+
r1
.
height
}
;
CvPoint
plt
(
r1
.
x
,
r1
.
y
)
;
CvPoint
prb
(
r1
.
x
+
r1
.
width
,
r1
.
y
+
r1
.
height
)
;
return
(
PointInRect
(
plt
,
r2
)
&&
PointInRect
(
prb
,
r2
));
}
...
...
modules/legacy/src/calibfilter.cpp
浏览文件 @
13b31b08
...
...
@@ -558,7 +558,7 @@ void CvCalibFilter::DrawPoints( CvMat** dstarr )
const
int
colorCount
=
sizeof
(
line_colors
)
/
sizeof
(
line_colors
[
0
]);
const
int
r
=
4
;
CvScalar
color
=
line_colors
[
0
];
CvPoint
prev_pt
=
{
0
,
0
}
;
CvPoint
prev_pt
;
for
(
j
=
0
;
j
<
count
;
j
++
)
{
...
...
modules/legacy/src/epilines.cpp
浏览文件 @
13b31b08
...
...
@@ -1826,7 +1826,7 @@ void icvGetCutPiece( CvVect64d areaLineCoef1,CvVect64d areaLineCoef2,
/* Collect all candidate point */
CvPoint2D64d
candPoints
[
8
];
CvPoint2D64d
midPoint
=
{
0
,
0
}
;
CvPoint2D64d
midPoint
;
int
numPoints
=
0
;
int
res
;
int
i
;
...
...
modules/legacy/src/lcm.cpp
浏览文件 @
13b31b08
...
...
@@ -694,7 +694,7 @@ void _cvProjectionPointToSegment(CvPoint2D32f* PointO,
float
*
dist
)
{
float
scal_AO_AB
,
scal_AB_AB
;
CvPoint2D32f
VectorAB
=
{
PointB
->
x
-
PointA
->
x
,
PointB
->
y
-
PointA
->
y
}
;
CvPoint2D32f
VectorAB
(
PointB
->
x
-
PointA
->
x
,
PointB
->
y
-
PointA
->
y
)
;
scal_AB_AB
=
VectorAB
.
x
*
VectorAB
.
x
+
VectorAB
.
y
*
VectorAB
.
y
;
if
(
scal_AB_AB
<
LCM_CONST_ZERO
)
{
...
...
@@ -704,7 +704,7 @@ void _cvProjectionPointToSegment(CvPoint2D32f* PointO,
return
;
}
CvPoint2D32f
VectorAO
=
{
PointO
->
x
-
PointA
->
x
,
PointO
->
y
-
PointA
->
y
}
;
CvPoint2D32f
VectorAO
(
PointO
->
x
-
PointA
->
x
,
PointO
->
y
-
PointA
->
y
)
;
scal_AO_AB
=
VectorAO
.
x
*
VectorAB
.
x
+
VectorAO
.
y
*
VectorAB
.
y
;
if
(
dist
)
...
...
modules/legacy/src/morphcontours.cpp
浏览文件 @
13b31b08
...
...
@@ -78,7 +78,7 @@ void _cvWorkEast (int i, int j, _CvWork** W, CvPoint2D32f* edges1, CvPoint2D
void
_cvWorkSouthEast
(
int
i
,
int
j
,
_CvWork
**
W
,
CvPoint2D32f
*
edges1
,
CvPoint2D32f
*
edges2
);
void
_cvWorkSouth
(
int
i
,
int
j
,
_CvWork
**
W
,
CvPoint2D32f
*
edges1
,
CvPoint2D32f
*
edges2
);
static
CvPoint2D32f
null_edge
=
{
0
,
0
}
;
static
CvPoint2D32f
null_edge
;
double
_cvStretchingWork
(
CvPoint2D32f
*
P1
,
CvPoint2D32f
*
P2
)
...
...
@@ -106,7 +106,7 @@ double _cvBendingWork( CvPoint2D32f* B0,
CvPoint* K*/
)
{
CvPoint2D32f
Q0
,
Q1
,
Q2
;
CvPoint2D32f
Q1_nm
=
{
0
,
0
},
Q2_nm
=
{
0
,
0
}
;
CvPoint2D32f
Q1_nm
,
Q2_nm
;
double
d0
,
d1
,
d2
,
des
,
t_zero
;
double
k_zero
,
k_nonmon
;
CvPoint2D32f
center
;
...
...
modules/legacy/src/segment.cpp
浏览文件 @
13b31b08
...
...
@@ -328,8 +328,8 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
}
#endif
const
CvPoint
icvCodeDeltas
[
8
]
=
{
{
1
,
0
},
{
1
,
-
1
},
{
0
,
-
1
},
{
-
1
,
-
1
},
{
-
1
,
0
},
{
-
1
,
1
},
{
0
,
1
},
{
1
,
1
}
};
static
const
CvPoint
icvCodeDeltas
[
8
]
=
{
CvPoint
(
1
,
0
),
CvPoint
(
1
,
-
1
),
CvPoint
(
0
,
-
1
),
CvPoint
(
-
1
,
-
1
),
CvPoint
(
-
1
,
0
),
CvPoint
(
-
1
,
1
),
CvPoint
(
0
,
1
),
CvPoint
(
1
,
1
)
};
static
CvSeq
*
icvGetComponent
(
uchar
*
img
,
int
step
,
CvRect
rect
,
...
...
@@ -366,7 +366,7 @@ icvGetComponent( uchar* img, int step, CvRect rect,
CvSeqWriter
writer
;
char
*
i0
,
*
i1
,
*
i3
,
*
i4
=
0
;
int
prev_s
=
-
1
,
s
,
s_end
;
CvPoint
pt
=
{
x
,
y
}
;
CvPoint
pt
(
x
,
y
)
;
if
(
!
(
prev
==
0
&&
p
==
2
)
)
/* if not external contour */
{
...
...
modules/legacy/src/vecfacetracking.cpp
浏览文件 @
13b31b08
...
...
@@ -749,11 +749,11 @@ int ChoiceTrackingFace2(CvFaceTracker* pTF, const int nElements, const CvFaceEle
face
[
element
[
0
]]
=
*
(
new_face
[
element
[
0
]]);
face
[
element
[
1
]]
=
*
(
new_face
[
element
[
1
]]);
// 3 element find by template
CvPoint
templ_v01
=
{
pTF
->
ptTempl
[
element
[
1
]].
x
-
pTF
->
ptTempl
[
element
[
0
]].
x
,
pTF
->
ptTempl
[
element
[
1
]].
y
-
pTF
->
ptTempl
[
element
[
0
]].
y
}
;
CvPoint
templ_v02
=
{
pTF
->
ptTempl
[
element
[
2
]].
x
-
pTF
->
ptTempl
[
element
[
0
]].
x
,
pTF
->
ptTempl
[
element
[
2
]].
y
-
pTF
->
ptTempl
[
element
[
0
]].
y
}
;
CvPoint
prev_v01
=
{
pTF
->
face
[
element
[
1
]].
ptCenter
.
x
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
x
,
pTF
->
face
[
element
[
1
]].
ptCenter
.
y
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
y
}
;
CvPoint
prev_v02
=
{
pTF
->
face
[
element
[
2
]].
ptCenter
.
x
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
x
,
pTF
->
face
[
element
[
2
]].
ptCenter
.
y
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
y
}
;
CvPoint
new_v01
=
{
new_face
[
element
[
1
]]
->
ptCenter
.
x
-
new_face
[
element
[
0
]]
->
ptCenter
.
x
,
new_face
[
element
[
1
]]
->
ptCenter
.
y
-
new_face
[
element
[
0
]]
->
ptCenter
.
y
}
;
CvPoint
templ_v01
(
pTF
->
ptTempl
[
element
[
1
]].
x
-
pTF
->
ptTempl
[
element
[
0
]].
x
,
pTF
->
ptTempl
[
element
[
1
]].
y
-
pTF
->
ptTempl
[
element
[
0
]].
y
)
;
CvPoint
templ_v02
(
pTF
->
ptTempl
[
element
[
2
]].
x
-
pTF
->
ptTempl
[
element
[
0
]].
x
,
pTF
->
ptTempl
[
element
[
2
]].
y
-
pTF
->
ptTempl
[
element
[
0
]].
y
)
;
CvPoint
prev_v01
(
pTF
->
face
[
element
[
1
]].
ptCenter
.
x
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
x
,
pTF
->
face
[
element
[
1
]].
ptCenter
.
y
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
y
)
;
CvPoint
prev_v02
(
pTF
->
face
[
element
[
2
]].
ptCenter
.
x
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
x
,
pTF
->
face
[
element
[
2
]].
ptCenter
.
y
-
pTF
->
face
[
element
[
0
]].
ptCenter
.
y
)
;
CvPoint
new_v01
(
new_face
[
element
[
1
]]
->
ptCenter
.
x
-
new_face
[
element
[
0
]]
->
ptCenter
.
x
,
new_face
[
element
[
1
]]
->
ptCenter
.
y
-
new_face
[
element
[
0
]]
->
ptCenter
.
y
)
;
double
templ_d01
=
sqrt
((
double
)
templ_v01
.
x
*
templ_v01
.
x
+
templ_v01
.
y
*
templ_v01
.
y
);
double
templ_d02
=
sqrt
((
double
)
templ_v02
.
x
*
templ_v02
.
x
+
templ_v02
.
y
*
templ_v02
.
y
);
double
prev_d01
=
sqrt
((
double
)
prev_v01
.
x
*
prev_v01
.
x
+
prev_v01
.
y
*
prev_v01
.
y
);
...
...
@@ -767,7 +767,7 @@ int ChoiceTrackingFace2(CvFaceTracker* pTF, const int nElements, const CvFaceEle
double
y
=
double
(
new_v01
.
x
)
*
sin_a
+
double
(
new_v01
.
y
)
*
cos_a
;
x
=
x
*
new_d02
/
new_d01
;
y
=
y
*
new_d02
/
new_d01
;
CvPoint
new_v02
=
{
int
(
x
+
0.5
),
int
(
y
+
0.5
)}
;
CvPoint
new_v02
(
int
(
x
+
0.5
),
int
(
y
+
0.5
))
;
face
[
element
[
2
]].
iColor
=
0
;
face
[
element
[
2
]].
iEnergy
=
0
;
face
[
element
[
2
]].
nRectsInThis
=
0
;
...
...
@@ -818,10 +818,10 @@ inline int GetEnergy(CvTrackingRect** ppNew, const CvTrackingRect* pPrev, CvPoin
inline
int
GetEnergy2
(
CvTrackingRect
**
ppNew
,
const
CvTrackingRect
*
pPrev
,
CvPoint
*
ptTempl
,
CvRect
*
rTempl
,
int
*
element
)
{
CvPoint
new_v
=
{
ppNew
[
element
[
0
]]
->
ptCenter
.
x
-
ppNew
[
element
[
1
]]
->
ptCenter
.
x
,
ppNew
[
element
[
0
]]
->
ptCenter
.
y
-
ppNew
[
element
[
1
]]
->
ptCenter
.
y
}
;
CvPoint
prev_v
=
{
pPrev
[
element
[
0
]].
ptCenter
.
x
-
pPrev
[
element
[
1
]].
ptCenter
.
x
,
pPrev
[
element
[
0
]].
ptCenter
.
y
-
pPrev
[
element
[
1
]].
ptCenter
.
y
}
;
CvPoint
new_v
(
ppNew
[
element
[
0
]]
->
ptCenter
.
x
-
ppNew
[
element
[
1
]]
->
ptCenter
.
x
,
ppNew
[
element
[
0
]]
->
ptCenter
.
y
-
ppNew
[
element
[
1
]]
->
ptCenter
.
y
)
;
CvPoint
prev_v
(
pPrev
[
element
[
0
]].
ptCenter
.
x
-
pPrev
[
element
[
1
]].
ptCenter
.
x
,
pPrev
[
element
[
0
]].
ptCenter
.
y
-
pPrev
[
element
[
1
]].
ptCenter
.
y
)
;
double
new_d
=
sqrt
((
double
)
new_v
.
x
*
new_v
.
x
+
new_v
.
y
*
new_v
.
y
);
double
prev_d
=
sqrt
((
double
)
prev_v
.
x
*
prev_v
.
x
+
prev_v
.
y
*
prev_v
.
y
);
double
dx
=
ptTempl
[
element
[
0
]].
x
-
ptTempl
[
element
[
1
]].
x
;
...
...
modules/legacy/test/test_pyrsegmentation.cpp
浏览文件 @
13b31b08
...
...
@@ -66,8 +66,8 @@ void CV_PyrSegmentationTest::run( int /*start_from*/ )
int
code
=
cvtest
::
TS
::
OK
;
CvPoint
_cp
[]
=
{
{
33
,
33
},
{
43
,
33
},
{
43
,
43
},
{
33
,
43
}
};
CvPoint
_cp2
[]
=
{
{
50
,
50
},
{
70
,
50
},
{
70
,
70
},
{
50
,
70
}
};
CvPoint
_cp
[]
=
{
CvPoint
(
33
,
33
),
CvPoint
(
43
,
33
),
CvPoint
(
43
,
43
),
CvPoint
(
33
,
43
)
};
CvPoint
_cp2
[]
=
{
CvPoint
(
50
,
50
),
CvPoint
(
70
,
50
),
CvPoint
(
70
,
70
),
CvPoint
(
50
,
70
)
};
CvPoint
*
cp
=
_cp
;
CvPoint
*
cp2
=
_cp2
;
CvConnectedComp
*
dst_comp
[
3
];
...
...
modules/ml/test/test_mltests2.cpp
浏览文件 @
13b31b08
...
...
@@ -397,7 +397,7 @@ float ann_calc_error( CvANN_MLP* ann, CvMLData* _data, map<int, int>& cls_map, i
int
si
=
sidx
?
sidx
[
i
]
:
i
;
cvGetRow
(
&
predictors
,
&
sample
,
si
);
ann
->
predict
(
&
sample
,
&
_output
);
CvPoint
best_cls
=
{
0
,
0
}
;
CvPoint
best_cls
;
cvMinMaxLoc
(
&
_output
,
0
,
0
,
0
,
&
best_cls
,
0
);
int
r
=
cvRound
(
responses
->
data
.
fl
[
si
*
r_step
]);
CV_DbgAssert
(
fabs
(
responses
->
data
.
fl
[
si
*
r_step
]
-
r
)
<
FLT_EPSILON
);
...
...
modules/objdetect/src/datamatrix.cpp
浏览文件 @
13b31b08
...
...
@@ -43,7 +43,7 @@ unsigned char ccblk[256] = { 34,17,2,17,19,19,2,17,36,36,2,36,19,19,2,17,51,51,2
36
,
19
,
19
,
2
,
32
,
66
,
66
,
2
,
66
,
19
,
19
,
2
,
66
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
66
,
51
,
51
,
2
,
51
,
19
,
19
,
2
,
51
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
32
,
49
,
49
,
2
,
49
,
19
,
19
,
2
,
49
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
49
,
51
,
51
,
2
,
51
,
19
,
19
,
2
,
51
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
49
,
66
,
66
,
2
,
66
,
19
,
19
,
2
,
66
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
66
,
51
,
51
,
2
,
51
,
19
,
19
,
2
,
51
,
36
,
36
,
2
,
36
,
19
,
19
,
2
,
34
};
static
const
CvPoint
pickup
[
64
]
=
{
{
7
,
6
},{
8
,
6
},{
7
,
5
},{
8
,
5
},{
1
,
5
},{
7
,
4
},{
8
,
4
},{
1
,
4
},{
1
,
8
},{
2
,
8
},{
1
,
7
},{
2
,
7
},{
3
,
7
},
static
const
int
pickup
[
64
][
2
]
=
{
{
7
,
6
},{
8
,
6
},{
7
,
5
},{
8
,
5
},{
1
,
5
},{
7
,
4
},{
8
,
4
},{
1
,
4
},{
1
,
8
},{
2
,
8
},{
1
,
7
},{
2
,
7
},{
3
,
7
},
{
1
,
6
},{
2
,
6
},{
3
,
6
},{
3
,
2
},{
4
,
2
},{
3
,
1
},{
4
,
1
},{
5
,
1
},{
3
,
8
},{
4
,
8
},{
5
,
8
},{
6
,
1
},{
7
,
1
},{
6
,
8
},{
7
,
8
},{
8
,
8
},{
6
,
7
},{
7
,
7
},{
8
,
7
},
{
4
,
7
},{
5
,
7
},{
4
,
6
},{
5
,
6
},{
6
,
6
},{
4
,
5
},{
5
,
5
},{
6
,
5
},{
2
,
5
},{
3
,
5
},{
2
,
4
},{
3
,
4
},{
4
,
4
},{
2
,
3
},{
3
,
3
},{
4
,
3
},{
8
,
3
},{
1
,
3
},{
8
,
2
},
{
1
,
2
},{
2
,
2
},{
8
,
1
},{
1
,
1
},{
2
,
1
},{
5
,
4
},{
6
,
4
},{
5
,
3
},{
6
,
3
},{
7
,
3
},{
5
,
2
},{
6
,
2
},{
7
,
2
}
};
...
...
@@ -255,7 +255,7 @@ static int decode(Sampler &sa, code &cc)
sum
+=
sa
.
getpixel
(
1
+
(
i
&
7
),
1
+
(
i
>>
3
));
uchar
mean
=
(
uchar
)(
sum
/
64
);
for
(
int
i
=
0
;
i
<
64
;
i
++
)
{
b
=
(
b
<<
1
)
+
(
sa
.
getpixel
(
pickup
[
i
]
.
x
,
pickup
[
i
].
y
)
<=
mean
);
b
=
(
b
<<
1
)
+
(
sa
.
getpixel
(
pickup
[
i
]
[
0
],
pickup
[
i
][
1
]
)
<=
mean
);
if
((
i
&
7
)
==
7
)
{
binary
[
i
>>
3
]
=
b
;
b
=
0
;
...
...
samples/c/find_obj.cpp
浏览文件 @
13b31b08
...
...
@@ -262,7 +262,7 @@ int main(int argc, char** argv)
printf
(
"Extraction time = %gms
\n
"
,
tt
/
(
cvGetTickFrequency
()
*
1000.
));
CvPoint
src_corners
[
4
]
=
{
{
0
,
0
},
{
object
->
width
,
0
},
{
object
->
width
,
object
->
height
},
{
0
,
object
->
height
}
};
CvPoint
src_corners
[
4
]
=
{
CvPoint
(
0
,
0
),
CvPoint
(
object
->
width
,
0
),
CvPoint
(
object
->
width
,
object
->
height
),
CvPoint
(
0
,
object
->
height
)
};
CvPoint
dst_corners
[
4
];
IplImage
*
correspond
=
cvCreateImage
(
cvSize
(
image
->
width
,
object
->
height
+
image
->
height
),
8
,
1
);
cvSetImageROI
(
correspond
,
cvRect
(
0
,
0
,
object
->
width
,
object
->
height
)
);
...
...
samples/cpp/letter_recog.cpp
浏览文件 @
13b31b08
...
...
@@ -463,7 +463,7 @@ int build_mlp_classifier( char* data_filename,
int
best_class
;
CvMat
sample
;
cvGetRow
(
data
,
&
sample
,
i
);
CvPoint
max_loc
=
{
0
,
0
}
;
CvPoint
max_loc
;
mlp
.
predict
(
&
sample
,
mlp_response
);
cvMinMaxLoc
(
mlp_response
,
0
,
0
,
0
,
&
max_loc
,
0
);
best_class
=
max_loc
.
x
+
'A'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录