Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
0daac6fd
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,发现更多精彩内容 >>
提交
0daac6fd
编写于
8月 26, 2013
作者:
R
Roman Donchenko
提交者:
OpenCV Buildbot
8月 26, 2013
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1327 from alalek:ocl_master_tests_fix
上级
f44ed7f3
7685b983
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
37 addition
and
46 deletion
+37
-46
modules/ocl/src/hog.cpp
modules/ocl/src/hog.cpp
+12
-8
modules/ocl/src/moments.cpp
modules/ocl/src/moments.cpp
+16
-22
modules/ocl/test/main.cpp
modules/ocl/test/main.cpp
+4
-3
modules/ocl/test/test_moments.cpp
modules/ocl/test/test_moments.cpp
+2
-3
modules/ocl/test/test_objdetect.cpp
modules/ocl/test/test_objdetect.cpp
+2
-5
modules/ocl/test/test_optflow.cpp
modules/ocl/test/test_optflow.cpp
+1
-5
未找到文件。
modules/ocl/src/hog.cpp
浏览文件 @
0daac6fd
...
...
@@ -1637,6 +1637,7 @@ void cv::ocl::device::hog::compute_hists(int nbins,
/
block_stride_x
;
int
img_block_height
=
(
height
-
CELLS_PER_BLOCK_Y
*
CELL_HEIGHT
+
block_stride_y
)
/
block_stride_y
;
int
blocks_total
=
img_block_width
*
img_block_height
;
int
grad_quadstep
=
grad
.
step
>>
2
;
int
qangle_step
=
qangle
.
step
;
...
...
@@ -1648,14 +1649,16 @@ void cv::ocl::device::hog::compute_hists(int nbins,
int
hists_size
=
(
nbins
*
CELLS_PER_BLOCK_X
*
CELLS_PER_BLOCK_Y
*
12
)
*
sizeof
(
float
);
int
final_hists_size
=
(
nbins
*
CELLS_PER_BLOCK_X
*
CELLS_PER_BLOCK_Y
)
*
sizeof
(
float
);
int
smem
=
hists_size
+
final_hists_size
;
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
width
));
int
smem
=
(
hists_size
+
final_hists_size
)
*
blocks_in_group
;
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
cblock_stride_x
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
cblock_stride_y
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
cnbins
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
cblock_hist_size
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
img_block_width
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
blocks_in_group
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
blocks_total
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
grad_quadstep
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
qangle_step
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
grad
.
data
));
...
...
@@ -1690,12 +1693,13 @@ void cv::ocl::device::hog::normalize_hists(int nbins,
String
kernelName
;
int
block_hist_size
=
nbins
*
CELLS_PER_BLOCK_X
*
CELLS_PER_BLOCK_Y
;
int
nthreads
=
power_2up
(
block_hist_size
);
int
img_block_width
=
(
width
-
CELLS_PER_BLOCK_X
*
CELL_WIDTH
+
block_stride_x
)
/
block_stride_x
;
int
img_block_height
=
(
height
-
CELLS_PER_BLOCK_Y
*
CELL_HEIGHT
+
block_stride_y
)
/
block_stride_y
;
size_t
globalThreads
[
3
]
=
{
img_block_width
*
nthreads
,
img_block_height
,
1
};
size_t
localThreads
[
3
]
=
{
nthreads
,
1
,
1
};
int
img_block_width
=
(
width
-
CELLS_PER_BLOCK_X
*
CELL_WIDTH
+
block_stride_x
)
/
block_stride_x
;
int
img_block_height
=
(
height
-
CELLS_PER_BLOCK_Y
*
CELL_HEIGHT
+
block_stride_y
)
/
block_stride_y
;
int
nthreads
;
size_t
globalThreads
[
3
]
=
{
1
,
1
,
1
};
size_t
localThreads
[
3
]
=
{
1
,
1
,
1
};
if
(
nbins
==
9
)
{
...
...
modules/ocl/src/moments.cpp
浏览文件 @
0daac6fd
...
...
@@ -46,6 +46,8 @@
#include "precomp.hpp"
#include <iostream>
#include "opencv2/imgproc/types_c.h"
#include "opencv2/imgproc/imgproc_c.h"
namespace
cv
{
...
...
@@ -53,7 +55,6 @@ namespace ocl
{
extern
const
char
*
moments
;
#if 0
// The function calculates center of gravity and the central second order moments
static
void
icvCompleteMomentState
(
CvMoments
*
moments
)
{
...
...
@@ -145,7 +146,7 @@ static void icvContourMoments( CvSeq* contour, CvMoments* mom )
cl_int
dst_step
=
(
cl_int
)
dst_a
.
step
;
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
dst_step
));
openCLExecuteKernel(dst_a.clCxt, &moments, "icvContourMoments", globalThreads, localThreads, args, -1, -1);
openCLExecuteKernel
2
(
dst_a
.
clCxt
,
&
moments
,
"icvContourMoments"
,
globalThreads
,
localThreads
,
args
,
-
1
,
-
1
);
cv
::
Mat
dst
(
dst_a
);
a00
=
a10
=
a01
=
a20
=
a11
=
a02
=
a30
=
a21
=
a12
=
a03
=
0.0
;
...
...
@@ -300,7 +301,7 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary )
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
coi
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
binary
));
args
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
TILE_SIZE
));
openCLExecuteKernel(Context::getContext(), &moments, "CvMoments", globalThreads, localThreads, args, -1, depth);
openCLExecuteKernel
2
(
Context
::
getContext
(),
&
moments
,
"CvMoments"
,
globalThreads
,
localThreads
,
args
,
-
1
,
depth
);
size_t
localThreadss
[
3
]
=
{
128
,
1
,
1
};
size_t
globalThreadss
[
3
]
=
{
128
,
1
,
1
};
...
...
@@ -309,41 +310,34 @@ static void ocl_cvMoments( const void* array, CvMoments* mom, int binary )
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
tile_height
));
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
tile_width
));
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
TILE_SIZE
));
args_sum.push_back( std::make_pair( sizeof(cl_mem) , (void *)&sum ));
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_mem
)
,
(
void
*
)
&
sum
.
data
));
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_mem
)
,
(
void
*
)
&
dst_m
.
data
));
args_sum
.
push_back
(
std
::
make_pair
(
sizeof
(
cl_int
)
,
(
void
*
)
&
dst_m
.
step
));
openCLExecuteKernel(Context::getContext(), &moments, "dst_sum", globalThreadss, localThreadss, args_sum, -1, -1);
openCLExecuteKernel
2
(
Context
::
getContext
(),
&
moments
,
"dst_sum"
,
globalThreadss
,
localThreadss
,
args_sum
,
-
1
,
-
1
);
Mat
dstsum
(
sum
);
mom->m00 = dstsum
[0]
;
mom->m10 = dstsum
[1]
;
mom->m01 = dstsum
[2]
;
mom->m20 = dstsum
[3]
;
mom->m11 = dstsum
[4]
;
mom->m02 = dstsum
[5]
;
mom->m30 = dstsum
[6]
;
mom->m21 = dstsum
[7]
;
mom->m12 = dstsum
[8]
;
mom->m03 = dstsum
[9]
;
mom
->
m00
=
dstsum
.
at
<
double
>
(
0
,
0
)
;
mom
->
m10
=
dstsum
.
at
<
double
>
(
0
,
1
)
;
mom
->
m01
=
dstsum
.
at
<
double
>
(
0
,
2
)
;
mom
->
m20
=
dstsum
.
at
<
double
>
(
0
,
3
)
;
mom
->
m11
=
dstsum
.
at
<
double
>
(
0
,
4
)
;
mom
->
m02
=
dstsum
.
at
<
double
>
(
0
,
5
)
;
mom
->
m30
=
dstsum
.
at
<
double
>
(
0
,
6
)
;
mom
->
m21
=
dstsum
.
at
<
double
>
(
0
,
7
)
;
mom
->
m12
=
dstsum
.
at
<
double
>
(
0
,
8
)
;
mom
->
m03
=
dstsum
.
at
<
double
>
(
0
,
9
)
;
icvCompleteMomentState
(
mom
);
}
#endif
Moments
ocl_moments
(
InputArray
_array
,
bool
binaryImage
)
{
#if 0
CvMoments
om
;
Mat
arr
=
_array
.
getMat
();
CvMat
c_array
=
arr
;
ocl_cvMoments
(
&
c_array
,
&
om
,
binaryImage
);
return
om
;
#endif
CV_Error
(
Error
::
StsNotImplemented
,
"ocl_moments is not implemented"
);
(
void
)
_array
;
(
void
)
binaryImage
;
return
Moments
();
}
}
...
...
modules/ocl/test/main.cpp
浏览文件 @
0daac6fd
...
...
@@ -43,11 +43,12 @@
#ifdef HAVE_OPENCL
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
ocl
;
using
namespace
cvtest
;
using
namespace
testing
;
using
std
::
cout
;
using
std
::
endl
;
void
print_info
()
{
...
...
@@ -86,11 +87,11 @@ int main(int argc, char **argv)
CommandLineParser
cmd
(
argc
,
argv
,
keys
);
if
(
cmd
.
get
<
string
>
(
"h"
)
==
"true"
)
{
cout
<<
"Avai
ble options besides goole test option
:"
<<
endl
;
cout
<<
"Avai
lable options besides google test options
:"
<<
endl
;
cmd
.
printMessage
();
return
0
;
}
string
type
=
cmd
.
get
<
s
tring
>
(
"t"
);
string
type
=
cmd
.
get
<
S
tring
>
(
"t"
);
unsigned
int
pid
=
cmd
.
get
<
unsigned
int
>
(
"p"
);
int
device
=
cmd
.
get
<
int
>
(
"d"
);
...
...
modules/ocl/test/test_moments.cpp
浏览文件 @
0daac6fd
...
...
@@ -7,8 +7,7 @@ using namespace cv;
using
namespace
cv
::
ocl
;
using
namespace
cvtest
;
using
namespace
testing
;
using
namespace
std
;
extern
string
workdir
;
PARAM_TEST_CASE
(
MomentsTest
,
MatType
,
bool
)
{
int
type
;
...
...
@@ -63,9 +62,9 @@ TEST_P(MomentsTest, Mat)
cv
::
Moments
oclMom
=
cv
::
ocl
::
ocl_moments
(
_array
,
binaryImage
);
Compare
(
CvMom
,
oclMom
);
}
}
INSTANTIATE_TEST_CASE_P
(
OCL_ImgProc
,
MomentsTest
,
Combine
(
Values
(
CV_8UC1
,
CV_16UC1
,
CV_16SC1
,
CV_64FC1
),
Values
(
true
,
false
)));
#endif // HAVE_OPENCL
modules/ocl/test/test_objdetect.cpp
浏览文件 @
0daac6fd
...
...
@@ -46,14 +46,11 @@
#include "test_precomp.hpp"
#include "opencv2/objdetect.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
testing
;
#ifdef HAVE_OPENCL
extern
string
workdir
;
///////////////////// HOG /////////////////////////////
PARAM_TEST_CASE
(
HOG
,
Size
,
int
)
{
...
...
@@ -196,14 +193,14 @@ PARAM_TEST_CASE(Haar, int, CascadeName)
int
flags
;
std
::
string
cascadeName
;
vector
<
Rect
>
faces
,
oclfaces
;
std
::
vector
<
Rect
>
faces
,
oclfaces
;
Mat
img
;
ocl
::
oclMat
d_img
;
virtual
void
SetUp
()
{
flags
=
GET_PARAM
(
0
);
cascadeName
=
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"cv/cascadeandhog/cascades/"
).
append
(
GET_PARAM
(
1
));
cascadeName
=
(
st
d
::
st
ring
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"cv/cascadeandhog/cascades/"
).
append
(
GET_PARAM
(
1
));
ASSERT_TRUE
(
cascade
.
load
(
cascadeName
));
ASSERT_TRUE
(
cpucascade
.
load
(
cascadeName
));
img
=
readImage
(
"cv/shared/lena.png"
,
IMREAD_GRAYSCALE
);
...
...
modules/ocl/test/test_optflow.cpp
浏览文件 @
0daac6fd
...
...
@@ -52,10 +52,6 @@ using namespace cv;
using
namespace
cv
::
ocl
;
using
namespace
cvtest
;
using
namespace
testing
;
using
namespace
std
;
extern
string
workdir
;
//////////////////////////////////////////////////////
// GoodFeaturesToTrack
...
...
@@ -144,7 +140,7 @@ PARAM_TEST_CASE(TVL1, bool)
};
TEST_P
(
TVL1
,
Accuracy
)
TEST_P
(
TVL1
,
DISABLED_Accuracy
)
// TODO implementations of TV1 in video module are different in 2.4 and master branches
{
cv
::
Mat
frame0
=
readImage
(
"gpu/opticalflow/rubberwhale1.png"
,
cv
::
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame0
.
empty
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录