Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
7ee60401
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
7ee60401
编写于
10月 11, 2012
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable Matx as Mat elements (bug #1705).
上级
e435674a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
0 deletion
+36
-0
modules/core/include/opencv2/core/core.hpp
modules/core/include/opencv2/core/core.hpp
+12
-0
modules/core/test/test_operations.cpp
modules/core/test/test_operations.cpp
+24
-0
未找到文件。
modules/core/include/opencv2/core/core.hpp
浏览文件 @
7ee60401
...
...
@@ -1107,6 +1107,18 @@ public:
type
=
CV_MAKETYPE
(
depth
,
channels
)
};
};
template
<
typename
_Tp
,
int
m
,
int
n
>
class
DataType
<
Matx
<
_Tp
,
m
,
n
>
>
{
public:
typedef
Matx
<
_Tp
,
m
,
n
>
value_type
;
typedef
Matx
<
typename
DataType
<
_Tp
>::
work_type
,
m
,
n
>
work_type
;
typedef
_Tp
channel_type
;
typedef
value_type
vec_type
;
enum
{
generic_type
=
0
,
depth
=
DataDepth
<
channel_type
>::
value
,
channels
=
m
*
n
,
fmt
=
((
channels
-
1
)
<<
8
)
+
DataDepth
<
channel_type
>::
fmt
,
type
=
CV_MAKETYPE
(
depth
,
channels
)
};
};
template
<
typename
_Tp
,
int
cn
>
class
DataType
<
Vec
<
_Tp
,
cn
>
>
{
public:
...
...
modules/core/test/test_operations.cpp
浏览文件 @
7ee60401
...
...
@@ -69,6 +69,7 @@ protected:
bool
SomeMatFunctions
();
bool
TestMat
();
template
<
typename
_Tp
>
void
TestType
(
Size
sz
,
_Tp
value
=
_Tp
(
1.
f
));
bool
TestTemplateMat
();
bool
TestMatND
();
bool
TestSparseMat
();
...
...
@@ -106,6 +107,19 @@ CV_OperationsTest::~CV_OperationsTest() {}
#define MSVC_OLD 0
#endif
template
<
typename
_Tp
>
void
CV_OperationsTest
::
TestType
(
Size
sz
,
_Tp
value
)
{
cv
::
Mat_
<
_Tp
>
m
(
sz
);
CV_Assert
(
m
.
cols
==
sz
.
width
&&
m
.
rows
==
sz
.
height
&&
m
.
depth
()
==
DataType
<
_Tp
>::
depth
&&
m
.
channels
()
==
DataType
<
_Tp
>::
channels
&&
m
.
elemSize
()
==
sizeof
(
_Tp
)
&&
m
.
step
==
m
.
elemSize
()
*
m
.
cols
);
for
(
int
y
=
0
;
y
<
sz
.
height
;
y
++
)
for
(
int
x
=
0
;
x
<
sz
.
width
;
x
++
)
m
(
y
,
x
)
=
value
;
CV_Assert
(
sum
(
m
.
reshape
(
1
,
1
))[
0
]
==
(
double
)
sz
.
width
*
sz
.
height
);
}
bool
CV_OperationsTest
::
TestMat
()
{
try
...
...
@@ -779,6 +793,16 @@ bool CV_OperationsTest::TestTemplateMat()
badarg_catched
=
true
;
}
CV_Assert
(
badarg_catched
);
#include <iostream>
#include <opencv2/core/core.hpp>
Size
size
(
2
,
5
);
TestType
<
float
>
(
size
);
TestType
<
cv
::
Vec3f
>
(
size
);
TestType
<
cv
::
Matx31f
>
(
size
);
TestType
<
cv
::
Matx41f
>
(
size
);
TestType
<
cv
::
Matx32f
>
(
size
);
}
catch
(
const
test_excep
&
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录