Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
110351d3
O
Opencv
项目概览
Greenplum
/
Opencv
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
110351d3
编写于
4月 08, 2011
作者:
V
Valentina Kustikova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bugs in the test for LatentSVM were fixed.
上级
ef066947
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
56 addition
and
14 deletion
+56
-14
modules/objdetect/src/latentsvm.cpp
modules/objdetect/src/latentsvm.cpp
+12
-1
modules/objdetect/src/latentsvmdetector.cpp
modules/objdetect/src/latentsvmdetector.cpp
+10
-4
modules/objdetect/test/test_latentsvmdetector.cpp
modules/objdetect/test/test_latentsvmdetector.cpp
+18
-4
tests/cv/src/latentsvmdetector.cpp
tests/cv/src/latentsvmdetector.cpp
+16
-5
未找到文件。
modules/objdetect/src/latentsvm.cpp
浏览文件 @
110351d3
...
...
@@ -576,10 +576,21 @@ int searchObjectThresholdSomeComponents(const CvLSVMFeaturePyramid *H,
for
(
i
=
0
;
i
<
kComponents
;
i
++
)
{
#ifdef HAVE_TBB
searchObjectThreshold
(
H
,
&
(
filters
[
componentIndex
]),
kPartFilters
[
i
],
error
=
searchObjectThreshold
(
H
,
&
(
filters
[
componentIndex
]),
kPartFilters
[
i
],
b
[
i
],
maxXBorder
,
maxYBorder
,
scoreThreshold
,
&
(
pointsArr
[
i
]),
&
(
levelsArr
[
i
]),
&
(
kPointsArr
[
i
]),
&
(
scoreArr
[
i
]),
&
(
partsDisplacementArr
[
i
]),
numThreads
);
if
(
error
!=
LATENT_SVM_OK
)
{
// Release allocated memory
free
(
pointsArr
);
free
(
oppPointsArr
);
free
(
scoreArr
);
free
(
kPointsArr
);
free
(
levelsArr
);
free
(
partsDisplacementArr
);
return
LATENT_SVM_SEARCH_OBJECT_FAILED
;
}
#else
searchObjectThreshold
(
H
,
&
(
filters
[
componentIndex
]),
kPartFilters
[
i
],
b
[
i
],
maxXBorder
,
maxYBorder
,
scoreThreshold
,
...
...
modules/objdetect/src/latentsvmdetector.cpp
浏览文件 @
110351d3
...
...
@@ -95,16 +95,22 @@ CvSeq* cvLatentSvmDetectObjects(IplImage* image,
CvPoint
*
oppPointsOut
=
0
;
float
*
scoreOut
=
0
;
CvSeq
*
result_seq
=
0
;
int
error
=
0
;
cvConvertImage
(
image
,
image
,
CV_CVTIMG_SWAP_RB
);
// Getting maximum filter dimensions
getMaxFilterDims
((
const
CvLSVMFilterObject
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
&
maxXBorder
,
&
maxYBorder
);
getMaxFilterDims
((
const
CvLSVMFilterObject
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
&
maxXBorder
,
&
maxYBorder
);
// Create feature pyramid with nullable border
H
=
createFeaturePyramidWithBorder
(
image
,
maxXBorder
,
maxYBorder
);
// Search object
searchObjectThresholdSomeComponents
(
H
,
(
const
CvLSVMFilterObject
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
detector
->
b
,
detector
->
score_threshold
,
&
points
,
&
oppPoints
,
&
score
,
&
kPoints
,
numThreads
);
error
=
searchObjectThresholdSomeComponents
(
H
,
(
const
CvLSVMFilterObject
**
)(
detector
->
filters
),
detector
->
num_components
,
detector
->
num_part_filters
,
detector
->
b
,
detector
->
score_threshold
,
&
points
,
&
oppPoints
,
&
score
,
&
kPoints
,
numThreads
);
if
(
error
!=
LATENT_SVM_OK
)
{
return
NULL
;
}
// Clipping boxes
clippingBoxes
(
image
->
width
,
image
->
height
,
points
,
kPoints
);
clippingBoxes
(
image
->
width
,
image
->
height
,
oppPoints
,
kPoints
);
...
...
modules/objdetect/test/test_latentsvmdetector.cpp
浏览文件 @
110351d3
...
...
@@ -44,6 +44,14 @@
#include <string>
#ifdef HAVE_CONFIG_H
#include <cvconfig.h>
#endif
#ifdef HAVE_TBB
#include "tbb/task_scheduler_init.h"
#endif
using
namespace
cv
;
const
int
num_detections
=
3
;
...
...
@@ -77,7 +85,12 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
{
string
img_path
=
string
(
ts
->
get_data_path
())
+
"latentsvmdetector/cat.jpg"
;
string
model_path
=
string
(
ts
->
get_data_path
())
+
"latentsvmdetector/cat.xml"
;
int
numThreads
=
-
1
;
#ifdef HAVE_TBB
numThreads
=
2
;
tbb
::
task_scheduler_init
init
(
tbb
::
task_scheduler_init
::
deferred
);
init
.
initialize
(
numThreads
);
#endif
IplImage
*
image
=
cvLoadImage
(
img_path
.
c_str
());
if
(
!
image
)
{
...
...
@@ -95,8 +108,7 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
CvMemStorage
*
storage
=
cvCreateMemStorage
(
0
);
CvSeq
*
detections
=
0
;
detections
=
cvLatentSvmDetectObjects
(
image
,
detector
,
storage
);
detections
=
cvLatentSvmDetectObjects
(
image
,
detector
,
storage
,
0.5
f
,
numThreads
);
if
(
detections
->
total
!=
num_detections
)
{
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_MISMATCH
);
...
...
@@ -116,7 +128,9 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
}
}
}
#ifdef HAVE_TBB
init
.
terminate
();
#endif
cvReleaseMemStorage
(
&
storage
);
cvReleaseLatentSvmDetector
(
&
detector
);
cvReleaseImage
(
&
image
);
...
...
tests/cv/src/latentsvmdetector.cpp
浏览文件 @
110351d3
...
...
@@ -43,6 +43,10 @@
#include "cvtest.h"
#include <string>
#ifdef HAVE_TBB
#include "tbb/task_scheduler_init.h"
#endif
using
namespace
cv
;
const
int
num_detections
=
3
;
...
...
@@ -75,27 +79,31 @@ bool CV_LatentSVMDetectorTest::isEqual(CvRect r1, CvRect r2)
void
CV_LatentSVMDetectorTest
::
run
(
int
/* start_from */
)
{
string
img_path
=
string
(
ts
->
get_data_path
())
+
"latentsvmdetector/cat.jpg"
;
string
model_path
=
string
(
ts
->
get_data_path
())
+
"latentsvmdetector/cat.xml"
;
int
numThreads
=
-
1
;
#ifdef HAVE_TBB
numThreads
=
2
;
tbb
::
task_scheduler_init
init
(
tbb
::
task_scheduler_init
::
deferred
);
init
.
initialize
(
numThreads
);
#endif
IplImage
*
image
=
cvLoadImage
(
img_path
.
c_str
());
if
(
!
image
)
{
ts
->
set_failed_test_info
(
Cv
TS
::
FAIL_INVALID_TEST_DATA
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_TEST_DATA
);
return
;
}
CvLatentSvmDetector
*
detector
=
cvLoadLatentSvmDetector
(
model_path
.
c_str
());
if
(
!
detector
)
{
ts
->
set_failed_test_info
(
Cv
TS
::
FAIL_INVALID_TEST_DATA
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_TEST_DATA
);
cvReleaseImage
(
&
image
);
return
;
}
CvMemStorage
*
storage
=
cvCreateMemStorage
(
0
);
CvSeq
*
detections
=
0
;
detections
=
cvLatentSvmDetectObjects
(
image
,
detector
,
storage
);
detections
=
cvLatentSvmDetectObjects
(
image
,
detector
,
storage
,
0.5
f
,
numThreads
);
if
(
detections
->
total
!=
num_detections
)
{
...
...
@@ -117,6 +125,9 @@ void CV_LatentSVMDetectorTest::run( int /* start_from */)
}
}
#ifdef HAVE_TBB
init
.
terminate
();
#endif
cvReleaseMemStorage
(
&
storage
);
cvReleaseLatentSvmDetector
(
&
detector
);
cvReleaseImage
(
&
image
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录