Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
b9e53ec8
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,发现更多精彩内容 >>
提交
b9e53ec8
编写于
7月 14, 2012
作者:
M
Marina Kolpakova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed build after r9027
上级
6dc5cd15
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
47 deletion
+38
-47
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+0
-1
modules/gpu/src/cascadeclassifier.cpp
modules/gpu/src/cascadeclassifier.cpp
+38
-46
未找到文件。
modules/gpu/include/opencv2/gpu/gpu.hpp
浏览文件 @
b9e53ec8
...
...
@@ -1437,7 +1437,6 @@ public:
int
detectMultiScale
(
const
GpuMat
&
image
,
GpuMat
&
objectsBuf
,
double
scaleFactor
=
1.1
,
int
minNeighbors
=
4
,
cv
::
Size
maxObjectSize
=
cv
::
Size
()
/*, Size minSize = Size()*/
);
void
preallocateIntegralBuffer
(
cv
::
Size
desired
);
Size
getClassifierSize
()
const
;
private:
bool
read
(
const
FileNode
&
root
);
...
...
modules/gpu/src/cascadeclassifier.cpp
浏览文件 @
b9e53ec8
...
...
@@ -67,8 +67,7 @@ cv::gpu::CascadeClassifier_GPU_LBP::~CascadeClassifier_GPU_LBP()
bool
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
empty
()
const
{
throw_nogpu
();
return
true
;
}
bool
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
load
(
const
string
&
)
{
throw_nogpu
();
return
true
;
}
Size
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
getClassifierSize
()
const
{
throw_nogpu
();
return
Size
();
}
void
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
preallocateIntegralBuffer
(
cv
::
Size
/*desired*/
)
{
throw_nogpu
();}
void
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
initializeBuffers
(
cv
::
Size
/*frame*/
)
{
throw_nogpu
();}
void
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
allocateBuffers
(
cv
::
Size
/*frame*/
)
{
throw_nogpu
();}
int
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
detectMultiScale
(
const
cv
::
gpu
::
GpuMat
&
/*image*/
,
cv
::
gpu
::
GpuMat
&
/*objectsBuf*/
,
double
/*scaleFactor*/
,
int
/*minNeighbors*/
,
cv
::
Size
/*maxObjectSize*/
){
throw_nogpu
();
return
0
;}
...
...
@@ -80,8 +79,8 @@ cv::gpu::CascadeClassifier_GPU_LBP::~CascadeClassifier_GPU_LBP(){}
void
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
allocateBuffers
(
cv
::
Size
frame
)
{
if
(
frame
==
cv
::
Size
())
return
;
if
(
frame
==
cv
::
Size
())
return
;
if
(
resuzeBuffer
.
empty
()
||
frame
.
width
>
resuzeBuffer
.
cols
||
frame
.
height
>
resuzeBuffer
.
rows
)
{
...
...
@@ -97,17 +96,10 @@ void cv::gpu::CascadeClassifier_GPU_LBP::allocateBuffers(cv::Size frame)
Ncv32u
bufSize
;
ncvSafeCall
(
nppiStIntegralGetSize_8u32u
(
roiSize
,
&
bufSize
,
prop
)
);
integralBuffer
.
create
(
1
,
bufSize
,
CV_8UC1
);
integralBuffer
.
create
(
1
,
bufSize
,
CV_8UC1
);
}
candidates
.
create
(
1
,
frame
.
width
>>
1
,
CV_32SC4
);
}
void
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
preallocateIntegralBuffer
(
cv
::
Size
desired
)
{
integral
.
create
(
desired
.
width
+
1
,
desired
.
height
+
1
,
CV_32SC1
);
candidates
.
create
(
1
,
frame
.
width
>>
1
,
CV_32SC4
);
}
bool
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
empty
()
const
{
return
stage_mat
.
empty
();
}
...
...
@@ -115,8 +107,8 @@ Size cv::gpu::CascadeClassifier_GPU_LBP::getClassifierSize() const { return NxM;
bool
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
load
(
const
string
&
classifierAsXml
)
{
FileStorage
fs
(
classifierAsXml
,
FileStorage
::
READ
);
return
fs
.
isOpened
()
?
read
(
fs
.
getFirstTopLevelNode
())
:
false
;
FileStorage
fs
(
classifierAsXml
,
FileStorage
::
READ
);
return
fs
.
isOpened
()
?
read
(
fs
.
getFirstTopLevelNode
())
:
false
;
}
struct
Stage
...
...
@@ -129,24 +121,24 @@ struct Stage
// currently only stump based boost classifiers are supported
bool
CascadeClassifier_GPU_LBP
::
read
(
const
FileNode
&
root
)
{
const
char
*
GPU_CC_STAGE_TYPE
=
"stageType"
;
const
char
*
GPU_CC_FEATURE_TYPE
=
"featureType"
;
const
char
*
GPU_CC_BOOST
=
"BOOST"
;
const
char
*
GPU_CC_LBP
=
"LBP"
;
const
char
*
GPU_CC_MAX_CAT_COUNT
=
"maxCatCount"
;
const
char
*
GPU_CC_HEIGHT
=
"height"
;
const
char
*
GPU_CC_WIDTH
=
"width"
;
const
char
*
GPU_CC_STAGE_PARAMS
=
"stageParams"
;
const
char
*
GPU_CC_MAX_DEPTH
=
"maxDepth"
;
const
char
*
GPU_CC_FEATURE_PARAMS
=
"featureParams"
;
const
char
*
GPU_CC_STAGES
=
"stages"
;
const
char
*
GPU_CC_STAGE_THRESHOLD
=
"stageThreshold"
;
const
float
GPU_THRESHOLD_EPS
=
1e-5
f
;
const
char
*
GPU_CC_WEAK_CLASSIFIERS
=
"weakClassifiers"
;
const
char
*
GPU_CC_INTERNAL_NODES
=
"internalNodes"
;
const
char
*
GPU_CC_LEAF_VALUES
=
"leafValues"
;
const
char
*
GPU_CC_FEATURES
=
"features"
;
const
char
*
GPU_CC_RECT
=
"rect"
;
const
char
*
GPU_CC_STAGE_TYPE
=
"stageType"
;
const
char
*
GPU_CC_FEATURE_TYPE
=
"featureType"
;
const
char
*
GPU_CC_BOOST
=
"BOOST"
;
const
char
*
GPU_CC_LBP
=
"LBP"
;
const
char
*
GPU_CC_MAX_CAT_COUNT
=
"maxCatCount"
;
const
char
*
GPU_CC_HEIGHT
=
"height"
;
const
char
*
GPU_CC_WIDTH
=
"width"
;
const
char
*
GPU_CC_STAGE_PARAMS
=
"stageParams"
;
const
char
*
GPU_CC_MAX_DEPTH
=
"maxDepth"
;
const
char
*
GPU_CC_FEATURE_PARAMS
=
"featureParams"
;
const
char
*
GPU_CC_STAGES
=
"stages"
;
const
char
*
GPU_CC_STAGE_THRESHOLD
=
"stageThreshold"
;
const
float
GPU_THRESHOLD_EPS
=
1e-5
f
;
const
char
*
GPU_CC_WEAK_CLASSIFIERS
=
"weakClassifiers"
;
const
char
*
GPU_CC_INTERNAL_NODES
=
"internalNodes"
;
const
char
*
GPU_CC_LEAF_VALUES
=
"leafValues"
;
const
char
*
GPU_CC_FEATURES
=
"features"
;
const
char
*
GPU_CC_RECT
=
"rect"
;
std
::
string
stageTypeStr
=
(
string
)
root
[
GPU_CC_STAGE_TYPE
];
CV_Assert
(
stageTypeStr
==
GPU_CC_BOOST
);
...
...
@@ -300,7 +292,7 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
double
scaleFactor
,
int
groupThreshold
,
cv
::
Size
maxObjectSize
/*, Size minSize=Size()*/
)
{
CV_Assert
(
!
empty
()
&&
scaleFactor
>
1
&&
image
.
depth
()
==
CV_8U
);
const
int
defaultObjSearchNum
=
100
;
const
float
grouping_eps
=
0.2
;
...
...
@@ -317,10 +309,10 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
maxObjectSize
=
image
.
size
();
allocateBuffers
(
image
.
size
());
unsigned
int
classified
=
0
;
GpuMat
dclassified
(
1
,
1
,
CV_32S
);
cudaSafeCall
(
cudaMemcpy
(
dclassified
.
ptr
(),
&
classified
,
sizeof
(
int
),
cudaMemcpyHostToDevice
)
);
unsigned
int
classified
=
0
;
GpuMat
dclassified
(
1
,
1
,
CV_32S
);
cudaSafeCall
(
cudaMemcpy
(
dclassified
.
ptr
(),
&
classified
,
sizeof
(
int
),
cudaMemcpyHostToDevice
)
);
//int step = 2;
// cv::gpu::device::lbp::bindIntegral(integral);
...
...
@@ -349,10 +341,10 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
gpu
::
resize
(
image
,
scaledImg
,
scaledImageSize
,
0
,
0
,
CV_INTER_LINEAR
);
gpu
::
integralBuffered
(
scaledImg
,
scaledIntegral
,
currBuff
);
int
step
=
factor
<=
2.
f
?
2
:
1
;
int
step
=
factor
<=
2.
f
?
2
:
1
;
device
::
lbp
::
classifyStumpFixed
(
integral
,
integral
.
step1
(),
stage_mat
,
stage_mat
.
cols
/
sizeof
(
Stage
),
nodes_mat
,
leaves_mat
,
subsets_mat
,
features_mat
,
processingRectSize
.
width
,
processingRectSize
.
height
,
windowSize
.
width
,
windowSize
.
height
,
factor
,
step
,
subsetSize
,
candidates
,
dclassified
.
ptr
<
unsigned
int
>
());
processingRectSize
.
width
,
processingRectSize
.
height
,
windowSize
.
width
,
windowSize
.
height
,
factor
,
step
,
subsetSize
,
candidates
,
dclassified
.
ptr
<
unsigned
int
>
());
factor
*=
scaleFactor
;
windowSize
=
cv
::
Size
(
cvRound
(
NxM
.
width
*
factor
),
cvRound
(
NxM
.
height
*
factor
));
...
...
@@ -363,13 +355,13 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
// cv::gpu::device::lbp::unbindIntegral();
if
(
groupThreshold
<=
0
||
objects
.
empty
())
return
0
;
cudaSafeCall
(
cudaMemcpy
(
&
classified
,
dclassified
.
ptr
(),
sizeof
(
int
),
cudaMemcpyDeviceToHost
)
);
device
::
lbp
::
connectedConmonents
(
candidates
,
classified
,
objects
,
groupThreshold
,
grouping_eps
,
dclassified
.
ptr
<
unsigned
int
>
());
cudaSafeCall
(
cudaMemcpy
(
&
classified
,
dclassified
.
ptr
(),
sizeof
(
int
),
cudaMemcpyDeviceToHost
)
);
cudaSafeCall
(
cudaMemcpy
(
&
classified
,
dclassified
.
ptr
(),
sizeof
(
int
),
cudaMemcpyDeviceToHost
)
);
device
::
lbp
::
connectedConmonents
(
candidates
,
classified
,
objects
,
groupThreshold
,
grouping_eps
,
dclassified
.
ptr
<
unsigned
int
>
());
cudaSafeCall
(
cudaMemcpy
(
&
classified
,
dclassified
.
ptr
(),
sizeof
(
int
),
cudaMemcpyDeviceToHost
)
);
cudaSafeCall
(
cudaDeviceSynchronize
()
);
return
classified
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录