Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
02118430
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,发现更多精彩内容 >>
提交
02118430
编写于
3月 15, 2013
作者:
M
marina.kolpakova
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
merge Detection structure for CPU and GPU soft cascade detectors
上级
77728115
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
77 addition
and
36 deletion
+77
-36
modules/softcascade/include/opencv2/softcascade.hpp
modules/softcascade/include/opencv2/softcascade.hpp
+8
-18
modules/softcascade/perf/perf_cuda_softcascade.cpp
modules/softcascade/perf/perf_cuda_softcascade.cpp
+5
-5
modules/softcascade/perf/perf_softcascade.cpp
modules/softcascade/perf/perf_softcascade.cpp
+1
-1
modules/softcascade/src/detector.cpp
modules/softcascade/src/detector.cpp
+51
-0
modules/softcascade/src/softcascade.cpp
modules/softcascade/src/softcascade.cpp
+2
-2
modules/softcascade/test/test_cuda_softcascade.cpp
modules/softcascade/test/test_cuda_softcascade.cpp
+4
-4
samples/cpp/peopledetect.cpp
samples/cpp/peopledetect.cpp
+3
-4
samples/gpu/softcascade.cpp
samples/gpu/softcascade.cpp
+3
-2
未找到文件。
modules/softcascade/include/opencv2/softcascade.hpp
浏览文件 @
02118430
...
...
@@ -49,18 +49,21 @@
namespace
cv
{
namespace
softcascade
{
// Representation of detectors result.
// We assume that image is less then 2^16x2^16.
struct
CV_EXPORTS
Detection
{
// Default object type.
enum
{
PEDESTRIAN
=
1
};
// Creates Detection from an object bounding box and confidence.
// Param b is a bounding box
// Param c is a confidence that object belongs to class k
// Param k is an object class
Detection
(
const
cv
::
Rect
&
b
,
const
float
c
,
int
k
=
PEDESTRIAN
)
:
bb
(
b
),
confidence
(
c
),
kind
(
k
)
{}
Detection
(
const
cv
::
Rect
&
b
,
const
float
c
,
int
k
=
PEDESTRIAN
);
cv
::
Rect
bb
()
const
;
enum
{
PEDESTRIAN
=
1
};
cv
::
Rect
bb
;
ushort
x
;
ushort
y
;
ushort
w
;
ushort
h
;
float
confidence
;
int
kind
;
};
...
...
@@ -247,19 +250,6 @@ class CV_EXPORTS SCascade : public cv::Algorithm
{
public:
// Representation of detectors result.
struct
CV_EXPORTS
Detection
{
ushort
x
;
ushort
y
;
ushort
w
;
ushort
h
;
float
confidence
;
int
kind
;
enum
{
PEDESTRIAN
=
0
};
};
enum
{
NO_REJECT
=
1
,
DOLLAR
=
2
,
/*PASCAL = 4,*/
DEFAULT
=
NO_REJECT
,
NMS_MASK
=
0xF
};
// An empty cascade will be created.
...
...
modules/softcascade/perf/perf_cuda_softcascade.cpp
浏览文件 @
02118430
...
...
@@ -27,8 +27,8 @@ void fixture##_##name::__cpu() { FAIL() << "No such CPU implementation analogy";
namespace
{
struct
DetectionLess
{
bool
operator
()(
const
cv
::
softcascade
::
SCascade
::
Detection
&
a
,
const
cv
::
softcascade
::
SCascade
::
Detection
&
b
)
const
bool
operator
()(
const
cv
::
softcascade
::
Detection
&
a
,
const
cv
::
softcascade
::
Detection
&
b
)
const
{
if
(
a
.
x
!=
b
.
x
)
return
a
.
x
<
b
.
x
;
else
if
(
a
.
y
!=
b
.
y
)
return
a
.
y
<
b
.
y
;
...
...
@@ -41,7 +41,7 @@ namespace {
{
cv
::
Mat
detections
(
objects
);
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
typedef
cv
::
softcascade
::
Detection
Detection
;
Detection
*
begin
=
(
Detection
*
)(
detections
.
ptr
<
char
>
(
0
));
Detection
*
end
=
(
Detection
*
)(
detections
.
ptr
<
char
>
(
0
)
+
detections
.
cols
);
std
::
sort
(
begin
,
end
,
DetectionLess
());
...
...
@@ -73,7 +73,7 @@ RUN_GPU(SCascadeTest, detect)
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
10000
*
sizeof
(
cv
::
softcascade
::
SCascade
::
Detection
),
CV_8UC1
),
rois
(
colored
.
size
(),
CV_8UC1
);
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
10000
*
sizeof
(
cv
::
softcascade
::
Detection
),
CV_8UC1
),
rois
(
colored
.
size
(),
CV_8UC1
);
rois
.
setTo
(
1
);
cascade
.
detect
(
colored
,
rois
,
objectBoxes
);
...
...
@@ -215,7 +215,7 @@ RUN_GPU(SCascadeTest, detectStream)
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
10000
*
sizeof
(
cv
::
softcascade
::
SCascade
::
Detection
),
CV_8UC1
),
rois
(
colored
.
size
(),
CV_8UC1
);
cv
::
gpu
::
GpuMat
objectBoxes
(
1
,
10000
*
sizeof
(
cv
::
softcascade
::
Detection
),
CV_8UC1
),
rois
(
colored
.
size
(),
CV_8UC1
);
rois
.
setTo
(
1
);
cv
::
gpu
::
Stream
s
;
...
...
modules/softcascade/perf/perf_softcascade.cpp
浏览文件 @
02118430
...
...
@@ -17,7 +17,7 @@ void extractRacts(std::vector<Detection> objectBoxes, std::vector<Rect>& rects)
{
rects
.
clear
();
for
(
int
i
=
0
;
i
<
(
int
)
objectBoxes
.
size
();
++
i
)
rects
.
push_back
(
objectBoxes
[
i
].
bb
);
rects
.
push_back
(
objectBoxes
[
i
].
bb
()
);
}
}
...
...
modules/softcascade/src/detector.cpp
0 → 100644
浏览文件 @
02118430
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2008-2013, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and / or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
cv
::
softcascade
::
Detection
::
Detection
(
const
cv
::
Rect
&
b
,
const
float
c
,
int
k
)
:
x
(
b
.
x
),
y
(
b
.
y
),
w
(
b
.
width
),
h
(
b
.
height
),
confidence
(
c
),
kind
(
k
)
{}
cv
::
Rect
cv
::
softcascade
::
Detection
::
bb
()
const
{
return
cv
::
Rect
(
x
,
y
,
w
,
h
);
}
\ No newline at end of file
modules/softcascade/src/softcascade.cpp
浏览文件 @
02118430
...
...
@@ -473,7 +473,7 @@ void DollarNMS(dvector& objects)
{
const
Detection
&
b
=
*
next
;
const
float
ovl
=
overlap
(
a
.
bb
,
b
.
bb
)
/
std
::
min
(
a
.
bb
.
area
(),
b
.
bb
.
area
());
const
float
ovl
=
overlap
(
a
.
bb
(),
b
.
bb
())
/
std
::
min
(
a
.
bb
().
area
(),
b
.
bb
()
.
area
());
if
(
ovl
>
DollarThreshold
)
next
=
objects
.
erase
(
next
);
...
...
@@ -588,7 +588,7 @@ void Detector::detect(InputArray _image, InputArray _rois, OutputArray _rects,
int
i
=
0
;
for
(
IDet
it
=
objects
.
begin
();
it
!=
objects
.
end
();
++
it
,
++
i
)
{
rectPtr
[
i
]
=
(
*
it
).
bb
;
rectPtr
[
i
]
=
(
*
it
).
bb
()
;
confPtr
[
i
]
=
(
*
it
).
confidence
;
}
}
\ No newline at end of file
modules/softcascade/test/test_cuda_softcascade.cpp
浏览文件 @
02118430
...
...
@@ -76,7 +76,7 @@ TEST(SCascadeTest, readCascade)
namespace
{
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
typedef
cv
::
softcascade
::
Detection
Detection
;
cv
::
Rect
getFromTable
(
int
idx
)
{
...
...
@@ -194,7 +194,7 @@ TEST_P(SCascadeTestRoi, Detect)
cascade
.
detect
(
colored
,
rois
,
objectBoxes
);
cv
::
Mat
dt
(
objectBoxes
);
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
typedef
cv
::
softcascade
::
Detection
Detection
;
Detection
*
dts
=
((
Detection
*
)
dt
.
data
)
+
1
;
int
*
count
=
dt
.
ptr
<
int
>
(
0
);
...
...
@@ -262,7 +262,7 @@ TEST_P(SCascadeTestAll, detect)
cascade
.
detect
(
colored
,
rois
,
objectBoxes
);
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
typedef
cv
::
softcascade
::
Detection
Detection
;
cv
::
Mat
dt
(
objectBoxes
);
...
...
@@ -303,7 +303,7 @@ TEST_P(SCascadeTestAll, detectStream)
cascade
.
detect
(
colored
,
rois
,
objectBoxes
,
s
);
s
.
waitForCompletion
();
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
typedef
cv
::
softcascade
::
Detection
Detection
;
cv
::
Mat
detections
(
objectBoxes
);
int
a
=
*
(
detections
.
ptr
<
int
>
(
0
));
ASSERT_EQ
(
a
,
expected
);
...
...
samples/cpp/peopledetect.cpp
浏览文件 @
02118430
...
...
@@ -139,12 +139,11 @@ int main(int argc, char** argv)
std
::
stringstream
conf
(
std
::
stringstream
::
in
|
std
::
stringstream
::
out
);
conf
<<
d
.
confidence
;
cv
::
rectangle
(
frame
,
cv
::
Rect
(
d
.
bb
.
x
,
d
.
bb
.
y
,
d
.
bb
.
width
,
d
.
bb
.
height
),
cv
::
Scalar
(
b
,
0
,
255
-
b
,
255
),
2
);
cv
::
putText
(
frame
,
conf
.
str
()
,
cv
::
Point
(
d
.
bb
.
x
+
10
,
d
.
bb
.
y
-
5
),
1
,
1.1
,
cv
::
Scalar
(
25
,
133
,
255
,
0
),
1
,
CV_AA
);
cv
::
rectangle
(
frame
,
cv
::
Rect
(
(
int
)
d
.
x
,
(
int
)
d
.
y
,
(
int
)
d
.
w
,
(
int
)
d
.
h
),
cv
::
Scalar
(
b
,
0
,
255
-
b
,
255
),
2
);
cv
::
putText
(
frame
,
conf
.
str
()
,
cv
::
Point
(
(
int
)
d
.
x
+
10
,
(
int
)
d
.
y
-
5
),
1
,
1.1
,
cv
::
Scalar
(
25
,
133
,
255
,
0
),
1
,
CV_AA
);
if
(
wf
)
myfile
<<
d
.
bb
.
x
<<
","
<<
d
.
bb
.
y
<<
","
<<
d
.
bb
.
width
<<
","
<<
d
.
bb
.
height
<<
","
<<
d
.
confidence
<<
"
\n
"
;
myfile
<<
d
.
x
<<
","
<<
d
.
y
<<
","
<<
d
.
w
<<
","
<<
d
.
h
<<
","
<<
d
.
confidence
<<
"
\n
"
;
}
}
}
...
...
samples/gpu/softcascade.cpp
浏览文件 @
02118430
...
...
@@ -3,6 +3,8 @@
#include <opencv2/highgui.hpp>
#include <iostream>
typedef
cv
::
softcascade
::
Detection
Detection
;
int
main
(
int
argc
,
char
**
argv
)
{
const
std
::
string
keys
=
...
...
@@ -64,7 +66,7 @@ int main(int argc, char** argv)
return
1
;
}
cv
::
gpu
::
GpuMat
objects
(
1
,
sizeof
(
SCascade
::
Detection
)
*
10000
,
CV_8UC1
);
cv
::
gpu
::
GpuMat
objects
(
1
,
sizeof
(
Detection
)
*
10000
,
CV_8UC1
);
cv
::
gpu
::
printShortCudaDeviceInfo
(
parser
.
get
<
int
>
(
"device"
));
for
(;;)
{
...
...
@@ -80,7 +82,6 @@ int main(int argc, char** argv)
cascade
.
detect
(
dframe
,
roi
,
objects
);
cv
::
Mat
dt
(
objects
);
typedef
cv
::
softcascade
::
SCascade
::
Detection
Detection
;
Detection
*
dts
=
((
Detection
*
)
dt
.
data
)
+
1
;
int
*
count
=
dt
.
ptr
<
int
>
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录