Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
0a83817a
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,发现更多精彩内容 >>
提交
0a83817a
编写于
4月 25, 2013
作者:
V
Vladislav Vinogradov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
switched to Input/Output Array in gpu::threshold
上级
44ec450b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
55 deletion
+58
-55
modules/gpuarithm/include/opencv2/gpuarithm.hpp
modules/gpuarithm/include/opencv2/gpuarithm.hpp
+3
-3
modules/gpuarithm/src/element_operations.cpp
modules/gpuarithm/src/element_operations.cpp
+7
-4
modules/gpuarithm/test/test_element_operations.cpp
modules/gpuarithm/test/test_element_operations.cpp
+48
-48
未找到文件。
modules/gpuarithm/include/opencv2/gpuarithm.hpp
浏览文件 @
0a83817a
...
...
@@ -131,6 +131,9 @@ static inline void scaleAdd(InputArray src1, double alpha, InputArray src2, Outp
addWeighted
(
src1
,
alpha
,
src2
,
1.0
,
0.0
,
dst
,
-
1
,
stream
);
}
//! applies fixed threshold to the image
CV_EXPORTS
double
threshold
(
InputArray
src
,
OutputArray
dst
,
double
thresh
,
double
maxval
,
int
type
,
Stream
&
stream
=
Stream
::
Null
());
//! implements generalized matrix product algorithm GEMM from BLAS
CV_EXPORTS
void
gemm
(
const
GpuMat
&
src1
,
const
GpuMat
&
src2
,
double
alpha
,
const
GpuMat
&
src3
,
double
beta
,
GpuMat
&
dst
,
int
flags
=
0
,
Stream
&
stream
=
Stream
::
Null
());
...
...
@@ -256,9 +259,6 @@ CV_EXPORTS void rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, co
CV_EXPORTS
void
copyMakeBorder
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
top
,
int
bottom
,
int
left
,
int
right
,
int
borderType
,
const
Scalar
&
value
=
Scalar
(),
Stream
&
stream
=
Stream
::
Null
());
//! applies fixed threshold to the image
CV_EXPORTS
double
threshold
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
double
thresh
,
double
maxval
,
int
type
,
Stream
&
stream
=
Stream
::
Null
());
//! computes the integral image
//! sum will have CV_32S type, but will contain unsigned int values
//! supports only CV_8UC1 source type
...
...
modules/gpuarithm/src/element_operations.cpp
浏览文件 @
0a83817a
...
...
@@ -75,7 +75,7 @@ void cv::gpu::max(InputArray, InputArray, OutputArray, Stream&) { throw_no_cuda(
void
cv
::
gpu
::
addWeighted
(
InputArray
,
double
,
InputArray
,
double
,
double
,
OutputArray
,
int
,
Stream
&
)
{
throw_no_cuda
();
}
double
cv
::
gpu
::
threshold
(
const
GpuMat
&
,
GpuMat
&
,
double
,
double
,
int
,
Stream
&
)
{
throw_no_cuda
();
return
0.0
;}
double
cv
::
gpu
::
threshold
(
InputArray
,
OutputArray
,
double
,
double
,
int
,
Stream
&
)
{
throw_no_cuda
();
return
0.0
;}
void
cv
::
gpu
::
magnitude
(
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_no_cuda
();
}
void
cv
::
gpu
::
magnitude
(
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
,
Stream
&
)
{
throw_no_cuda
();
}
...
...
@@ -2938,8 +2938,10 @@ namespace arithm
void
threshold
(
PtrStepSzb
src
,
PtrStepSzb
dst
,
double
thresh
,
double
maxVal
,
int
type
,
cudaStream_t
stream
);
}
double
cv
::
gpu
::
threshold
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
double
thresh
,
double
maxVal
,
int
type
,
Stream
&
s
)
double
cv
::
gpu
::
threshold
(
InputArray
_src
,
OutputArray
_dst
,
double
thresh
,
double
maxVal
,
int
type
,
Stream
&
_stream
)
{
GpuMat
src
=
_src
.
getGpuMat
();
const
int
depth
=
src
.
depth
();
CV_Assert
(
src
.
channels
()
==
1
&&
depth
<=
CV_64F
);
...
...
@@ -2951,9 +2953,10 @@ double cv::gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double
CV_Error
(
cv
::
Error
::
StsUnsupportedFormat
,
"The device doesn't support double"
);
}
dst
.
create
(
src
.
size
(),
src
.
type
());
_dst
.
create
(
src
.
size
(),
src
.
type
());
GpuMat
dst
=
_dst
.
getGpuMat
();
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
_stream
);
if
(
src
.
type
()
==
CV_32FC1
&&
type
==
2
/*THRESH_TRUNC*/
)
{
...
...
modules/gpuarithm/test/test_element_operations.cpp
浏览文件 @
0a83817a
...
...
@@ -2526,6 +2526,54 @@ INSTANTIATE_TEST_CASE_P(GPU_Arithm, AddWeighted, testing::Combine(
ALL_DEPTH
,
WHOLE_SUBMAT
));
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Threshold
CV_ENUM
(
ThreshOp
,
cv
::
THRESH_BINARY
,
cv
::
THRESH_BINARY_INV
,
cv
::
THRESH_TRUNC
,
cv
::
THRESH_TOZERO
,
cv
::
THRESH_TOZERO_INV
)
#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))
PARAM_TEST_CASE
(
Threshold
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
MatType
,
ThreshOp
,
UseRoi
)
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
int
type
;
int
threshOp
;
bool
useRoi
;
virtual
void
SetUp
()
{
devInfo
=
GET_PARAM
(
0
);
size
=
GET_PARAM
(
1
);
type
=
GET_PARAM
(
2
);
threshOp
=
GET_PARAM
(
3
);
useRoi
=
GET_PARAM
(
4
);
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
}
};
GPU_TEST_P
(
Threshold
,
Accuracy
)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
double
maxVal
=
randomDouble
(
20.0
,
127.0
);
double
thresh
=
randomDouble
(
0.0
,
maxVal
);
cv
::
gpu
::
GpuMat
dst
=
createMat
(
src
.
size
(),
src
.
type
(),
useRoi
);
cv
::
gpu
::
threshold
(
loadMat
(
src
,
useRoi
),
dst
,
thresh
,
maxVal
,
threshOp
);
cv
::
Mat
dst_gold
;
cv
::
threshold
(
src
,
dst_gold
,
thresh
,
maxVal
,
threshOp
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
0.0
);
}
INSTANTIATE_TEST_CASE_P
(
GPU_Arithm
,
Threshold
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_16SC1
),
MatType
(
CV_32FC1
)),
ALL_THRESH_OPS
,
WHOLE_SUBMAT
));
////////////////////////////////////////////////////////////////////////////////
// Magnitude
...
...
@@ -2744,52 +2792,4 @@ INSTANTIATE_TEST_CASE_P(GPU_Arithm, PolarToCart, testing::Combine(
testing
::
Values
(
AngleInDegrees
(
false
),
AngleInDegrees
(
true
)),
WHOLE_SUBMAT
));
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Threshold
CV_ENUM
(
ThreshOp
,
cv
::
THRESH_BINARY
,
cv
::
THRESH_BINARY_INV
,
cv
::
THRESH_TRUNC
,
cv
::
THRESH_TOZERO
,
cv
::
THRESH_TOZERO_INV
)
#define ALL_THRESH_OPS testing::Values(ThreshOp(cv::THRESH_BINARY), ThreshOp(cv::THRESH_BINARY_INV), ThreshOp(cv::THRESH_TRUNC), ThreshOp(cv::THRESH_TOZERO), ThreshOp(cv::THRESH_TOZERO_INV))
PARAM_TEST_CASE
(
Threshold
,
cv
::
gpu
::
DeviceInfo
,
cv
::
Size
,
MatType
,
ThreshOp
,
UseRoi
)
{
cv
::
gpu
::
DeviceInfo
devInfo
;
cv
::
Size
size
;
int
type
;
int
threshOp
;
bool
useRoi
;
virtual
void
SetUp
()
{
devInfo
=
GET_PARAM
(
0
);
size
=
GET_PARAM
(
1
);
type
=
GET_PARAM
(
2
);
threshOp
=
GET_PARAM
(
3
);
useRoi
=
GET_PARAM
(
4
);
cv
::
gpu
::
setDevice
(
devInfo
.
deviceID
());
}
};
GPU_TEST_P
(
Threshold
,
Accuracy
)
{
cv
::
Mat
src
=
randomMat
(
size
,
type
);
double
maxVal
=
randomDouble
(
20.0
,
127.0
);
double
thresh
=
randomDouble
(
0.0
,
maxVal
);
cv
::
gpu
::
GpuMat
dst
=
createMat
(
src
.
size
(),
src
.
type
(),
useRoi
);
cv
::
gpu
::
threshold
(
loadMat
(
src
,
useRoi
),
dst
,
thresh
,
maxVal
,
threshOp
);
cv
::
Mat
dst_gold
;
cv
::
threshold
(
src
,
dst_gold
,
thresh
,
maxVal
,
threshOp
);
EXPECT_MAT_NEAR
(
dst_gold
,
dst
,
0.0
);
}
INSTANTIATE_TEST_CASE_P
(
GPU_Arithm
,
Threshold
,
testing
::
Combine
(
ALL_DEVICES
,
DIFFERENT_SIZES
,
testing
::
Values
(
MatType
(
CV_8UC1
),
MatType
(
CV_16SC1
),
MatType
(
CV_32FC1
)),
ALL_THRESH_OPS
,
WHOLE_SUBMAT
));
#endif // HAVE_CUDA
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录