Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
f5742e6c
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,发现更多精彩内容 >>
提交
f5742e6c
编写于
10月 17, 2012
作者:
V
Vadim Pisarevsky
提交者:
Andrey Kamaev
10月 18, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug #2447 - unary operator bug for single column matrix
上级
04384a71
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
25 deletion
+39
-25
modules/core/src/arithm.cpp
modules/core/src/arithm.cpp
+24
-25
modules/core/test/test_operations.cpp
modules/core/test/test_operations.cpp
+15
-0
未找到文件。
modules/core/src/arithm.cpp
浏览文件 @
f5742e6c
...
...
@@ -1218,28 +1218,21 @@ namespace cv
static
int
actualScalarDepth
(
const
double
*
data
,
int
len
)
{
double
minval
=
data
[
0
];
double
maxval
=
data
[
0
];
for
(
int
i
=
1
;
i
<
len
;
++
i
)
{
minval
=
MIN
(
minval
,
data
[
i
]);
maxval
=
MAX
(
maxval
,
data
[
i
]);
}
int
depth
=
CV_64F
;
if
(
minval
>=
0
&&
maxval
<=
UCHAR_MAX
)
depth
=
CV_8U
;
else
if
(
minval
>=
SCHAR_MIN
&&
maxval
<=
SCHAR_MAX
)
depth
=
CV_8S
;
else
if
(
minval
>=
0
&&
maxval
<=
USHRT_MAX
)
depth
=
CV_16U
;
else
if
(
minval
>=
SHRT_MIN
&&
maxval
<=
SHRT_MAX
)
depth
=
CV_16S
;
else
if
(
minval
>=
INT_MIN
&&
maxval
<=
INT_MAX
)
depth
=
CV_32S
;
else
if
(
minval
>=
-
FLT_MAX
&&
maxval
<=
FLT_MAX
)
depth
=
CV_32F
;
return
depth
;
int
i
=
0
,
minval
=
INT_MAX
,
maxval
=
INT_MIN
;
for
(;
i
<
len
;
++
i
)
{
int
ival
=
cvRound
(
data
[
i
]);
if
(
ival
!=
data
[
i
]
)
break
;
minval
=
MIN
(
minval
,
ival
);
maxval
=
MAX
(
maxval
,
ival
);
}
return
i
<
len
?
CV_64F
:
minval
>=
0
&&
maxval
<=
UCHAR_MAX
?
CV_8U
:
minval
>=
SCHAR_MIN
&&
maxval
<=
SCHAR_MAX
?
CV_8S
:
minval
>=
0
&&
maxval
<=
USHRT_MAX
?
CV_16U
:
minval
>=
SHRT_MIN
&&
maxval
<=
SHRT_MAX
?
CV_16S
:
CV_32S
;
}
static
void
arithm_op
(
InputArray
_src1
,
InputArray
_src2
,
OutputArray
_dst
,
...
...
@@ -1264,7 +1257,9 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
bool
haveScalar
=
false
,
swapped12
=
false
;
int
depth2
=
src2
.
depth
();
if
(
src1
.
size
!=
src2
.
size
||
src1
.
channels
()
!=
src2
.
channels
()
)
if
(
src1
.
size
!=
src2
.
size
||
src1
.
channels
()
!=
src2
.
channels
()
||
((
kind1
==
_InputArray
::
MATX
||
kind2
==
_InputArray
::
MATX
)
&&
src1
.
cols
==
1
&&
src2
.
rows
==
4
)
)
{
if
(
checkScalar
(
src1
,
src2
.
type
(),
kind1
,
kind2
)
)
{
...
...
@@ -1279,10 +1274,14 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
haveScalar
=
true
;
CV_Assert
(
src2
.
type
()
==
CV_64F
&&
(
src2
.
rows
==
4
||
src2
.
rows
==
1
));
if
(
usrdata
==
0
)
// hack to filter out multiply and divide
if
(
!
muldiv
)
{
depth2
=
actualScalarDepth
(
src2
.
ptr
<
double
>
(),
src1
.
channels
());
if
(
depth2
==
CV_64F
&&
(
src1
.
depth
()
<
CV_32S
||
src1
.
depth
()
==
CV_32F
)
)
depth2
=
CV_32F
;
}
else
depth2
=
CV_64F
;
depth2
=
src1
.
depth
()
<
CV_32S
||
src1
.
depth
()
==
CV_32F
?
CV_32F
:
CV_64F
;
}
int
cn
=
src1
.
channels
(),
depth1
=
src1
.
depth
(),
wtype
;
...
...
modules/core/test/test_operations.cpp
浏览文件 @
f5742e6c
...
...
@@ -76,6 +76,7 @@ protected:
bool
TestVec
();
bool
TestMatxMultiplication
();
bool
TestSubMatAccess
();
bool
TestExp
();
bool
TestSVD
();
bool
operations1
();
...
...
@@ -1003,6 +1004,17 @@ bool CV_OperationsTest::operations1()
}
bool
CV_OperationsTest
::
TestExp
()
{
Mat1f
tt
=
Mat1f
::
ones
(
4
,
2
);
Mat1f
outs
;
exp
(
-
tt
,
outs
);
Mat1f
tt2
=
Mat1f
::
ones
(
4
,
1
),
outs2
;
exp
(
-
tt2
,
outs2
);
return
true
;
}
bool
CV_OperationsTest
::
TestSVD
()
{
try
...
...
@@ -1079,6 +1091,9 @@ void CV_OperationsTest::run( int /* start_from */)
if
(
!
TestSubMatAccess
())
return
;
if
(
!
TestExp
())
return
;
if
(
!
TestSVD
())
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录