Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
2f13e4ce
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,发现更多精彩内容 >>
提交
2f13e4ce
编写于
12月 29, 2010
作者:
A
Alexey Spizhevoy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactored hog, added camera support into hog_sample
上级
16bcf9b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
150 addition
and
148 deletion
+150
-148
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+13
-8
samples/gpu/hog.cpp
samples/gpu/hog.cpp
+137
-140
未找到文件。
modules/gpu/include/opencv2/gpu/gpu.hpp
浏览文件 @
2f13e4ce
...
...
@@ -1178,21 +1178,25 @@ namespace cv
size_t
getDescriptorSize
()
const
;
size_t
getBlockHistogramSize
()
const
;
double
getWinSigma
()
const
;
void
setSVMDetector
(
const
vector
<
float
>&
detector
);
bool
checkDetectorSize
()
const
;
static
vector
<
float
>
getDefaultPeopleDetector
();
static
vector
<
float
>
getPeopleDetector_48x96
();
static
vector
<
float
>
getPeopleDetector_64x128
();
void
setSVMDetector
(
const
vector
<
float
>&
detector
);
bool
checkDetectorSize
()
const
;
void
detect
(
const
GpuMat
&
img
,
vector
<
Point
>&
found_locations
,
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
());
void
detect
(
const
GpuMat
&
img
,
vector
<
Point
>&
found_locations
,
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
());
void
detectMultiScale
(
const
GpuMat
&
img
,
vector
<
Rect
>&
found_locations
,
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
(),
double
scale0
=
1.05
,
int
group_threshold
=
2
);
double
hit_threshold
=
0
,
Size
win_stride
=
Size
(),
Size
padding
=
Size
(),
double
scale0
=
1.05
,
int
group_threshold
=
2
);
void
getDescriptors
(
const
GpuMat
&
img
,
Size
win_stride
,
GpuMat
&
descriptors
,
void
getDescriptors
(
const
GpuMat
&
img
,
Size
win_stride
,
GpuMat
&
descriptors
,
int
descr_format
=
DESCR_FORMAT_COL_BY_COL
);
Size
win_size
;
...
...
@@ -1208,6 +1212,7 @@ namespace cv
protected:
void
computeBlockHistograms
(
const
GpuMat
&
img
);
void
computeGradient
(
const
GpuMat
&
img
,
GpuMat
&
grad
,
GpuMat
&
qangle
);
double
getWinSigma
()
const
;
static
int
numPartsWithin
(
int
size
,
int
part_size
,
int
stride
);
static
Size
numPartsWithin
(
Size
size
,
Size
part_size
,
Size
stride
);
...
...
samples/gpu/hog.cpp
浏览文件 @
2f13e4ce
...
...
@@ -12,61 +12,56 @@ using namespace cv;
//#define WRITE_VIDEO
/** Contains all properties of application (including those which can be
changed by user in runtime) */
class
Settings
class
Args
{
public:
/** Sets default values */
Settings
();
/** Reads settings from command args */
static
Settings
Read
(
int
argc
,
char
**
argv
);
Args
();
static
Args
read
(
int
argc
,
char
**
argv
);
string
src
;
bool
src_is_video
;
bool
src_is_camera
;
int
camera_id
;
bool
make_gray
;
bool
resize_src
;
double
resize_src_scale
;
int
resized_width
,
resized_height
;
double
scale
;
int
nlevels
;
int
gr_threshold
;
double
hit_threshold
;
int
win_width
;
int
win_stride_width
;
int
win_stride_height
;
int
win_stride_width
,
win_stride_height
;
bool
gamma_corr
;
};
/** Describes aplication logic */
class
App
{
public:
/** Initializes application */
App
(
const
Settings
&
s
);
/** Runs demo using OpenCV highgui module for GUI building */
void
RunOpencvGui
();
App
(
const
Args
&
s
);
void
run
();
/** Processes user keybord input */
void
HandleKey
(
char
key
);
void
handleKey
(
char
key
);
void
H
ogWorkBegin
();
void
H
ogWorkEnd
();
double
H
ogWorkFps
()
const
;
void
h
ogWorkBegin
();
void
h
ogWorkEnd
();
string
h
ogWorkFps
()
const
;
void
W
orkBegin
();
void
W
orkEnd
();
double
W
orkFps
()
const
;
void
w
orkBegin
();
void
w
orkEnd
();
string
w
orkFps
()
const
;
const
string
GetPerformanceSummary
()
const
;
string
message
()
const
;
private:
App
operator
=
(
App
&
);
Settings
settin
gs
;
Args
ar
gs
;
bool
running
;
bool
use_gpu
;
...
...
@@ -89,26 +84,29 @@ int main(int argc, char** argv)
{
try
{
cout
<<
"Histogram of Oriented Gradients descriptor and detector sample.
\n
"
;
if
(
argc
<
2
)
{
cout
<<
"Usage:
\n
hog_gpu
\n
"
<<
" -src <path_to_the_source>
\n
"
<<
" [-src_is_video <true/false>] # says to interp. src as img or as video
\n
"
<<
" [-make_gray <true/false>] # convert image to gray one or not
\n
"
<<
" [-resize_src <true/false>] # do resize of the source image or not
\n
"
<<
" [-resize_src_scale <double>] # preprocessing image scale factor
\n
"
<<
" [-hit_threshold <double>] # classifying plane dist. threshold (0.0 usually)
\n
"
<<
" [-scale <double>] # HOG window scale factor
\n
"
<<
" [-nlevels <int>] # max number of HOG window scales
\n
"
<<
" [-win_width <int>] # width of the window (48 or 64)
\n
"
<<
" [-win_stride_width <int>] # distance by OX axis between neighbour wins
\n
"
<<
" [-win_stride_height <int>] # distance by OY axis between neighbour wins
\n
"
<<
" [-gr_threshold <int>] # merging similar rects constant
\n
"
<<
" [-gamma_corr <int>] # do gamma correction or not
\n
"
;
cout
<<
"
\n
Usage: hog_gpu
\n
"
<<
" --src <path> # it's image file by default
\n
"
<<
" [--src-is-video <true/false>] # says to interpretate src as video
\n
"
<<
" [--src-is-camera <true/false>] # says to interpretate src as camera
\n
"
<<
" [--make-gray <true/false>] # convert image to gray one or not
\n
"
<<
" [--resize-src <true/false>] # do resize of the source image or not
\n
"
<<
" [--src-width <int>] # resized image width
\n
"
<<
" [--src-height <int>] # resized image height
\n
"
<<
" [--hit-threshold <double>] # classifying plane distance threshold (0.0 usually)
\n
"
<<
" [--scale <double>] # HOG window scale factor
\n
"
<<
" [--nlevels <int>] # max number of HOG window scales
\n
"
<<
" [--win-width <int>] # width of the window (48 or 64)
\n
"
<<
" [--win-stride-width <int>] # distance by OX axis between neighbour wins
\n
"
<<
" [--win-stride-height <int>] # distance by OY axis between neighbour wins
\n
"
<<
" [--gr-threshold <int>] # merging similar rects constant
\n
"
<<
" [--gamma-correct <int>] # do gamma correction or not
\n
"
;
return
1
;
}
App
app
(
Settings
::
R
ead
(
argc
,
argv
));
app
.
RunOpencvGui
();
App
app
(
Args
::
r
ead
(
argc
,
argv
));
app
.
run
();
}
catch
(
const
Exception
&
e
)
{
return
cout
<<
"Error: "
<<
e
.
what
()
<<
endl
,
1
;
}
catch
(
const
exception
&
e
)
{
return
cout
<<
"Error: "
<<
e
.
what
()
<<
endl
,
1
;
}
...
...
@@ -117,56 +115,63 @@ int main(int argc, char** argv)
}
Settings
::
Settin
gs
()
Args
::
Ar
gs
()
{
src_is_video
=
false
;
src_is_camera
=
false
;
camera_id
=
0
;
make_gray
=
false
;
resize_src
=
true
;
resize_src_scale
=
1.5
;
resize_src
=
false
;
resized_width
=
640
;
resized_height
=
480
;
scale
=
1.05
;
nlevels
=
13
;
gr_threshold
=
8
;
hit_threshold
=
1.4
;
win_width
=
48
;
win_stride_width
=
8
;
win_stride_height
=
8
;
gamma_corr
=
true
;
}
Settings
Settings
::
R
ead
(
int
argc
,
char
**
argv
)
Args
Args
::
r
ead
(
int
argc
,
char
**
argv
)
{
cout
<<
"Parsing command args"
<<
endl
;
Settings
settings
;
Args
args
;
for
(
int
i
=
1
;
i
<
argc
-
1
;
i
+=
2
)
{
string
key
=
argv
[
i
];
string
val
=
argv
[
i
+
1
];
if
(
key
==
"-src"
)
settings
.
src
=
val
;
else
if
(
key
==
"-src_is_video"
)
settings
.
src_is_video
=
(
val
==
"true"
);
else
if
(
key
==
"-make_gray"
)
settings
.
make_gray
=
(
val
==
"true"
);
else
if
(
key
==
"-resize_src"
)
settings
.
resize_src
=
(
val
==
"true"
);
else
if
(
key
==
"-resize_src_scale"
)
settings
.
resize_src_scale
=
atof
(
val
.
c_str
());
else
if
(
key
==
"-hit_threshold"
)
settings
.
hit_threshold
=
atof
(
val
.
c_str
());
else
if
(
key
==
"-scale"
)
settings
.
scale
=
atof
(
val
.
c_str
());
else
if
(
key
==
"-nlevels"
)
settings
.
nlevels
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"-win_width"
)
settings
.
win_width
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"-win_stride_width"
)
settings
.
win_stride_width
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"-win_stride_height"
)
settings
.
win_stride_height
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"-gr_threshold"
)
settings
.
gr_threshold
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"-gamma_corr"
)
settings
.
gamma_corr
=
atoi
(
val
.
c_str
())
!=
0
;
else
throw
runtime_error
((
string
(
"Unknown key: "
)
+
key
));
if
(
key
==
"--src"
)
args
.
src
=
val
;
else
if
(
key
==
"--src-is-video"
)
args
.
src_is_video
=
(
val
==
"true"
);
else
if
(
key
==
"--src-is-camera"
)
args
.
src_is_camera
=
(
val
==
"true"
);
else
if
(
key
==
"--camera-id"
)
args
.
camera_id
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--make-gray"
)
args
.
make_gray
=
(
val
==
"true"
);
else
if
(
key
==
"--resize-src"
)
args
.
resize_src
=
(
val
==
"true"
);
else
if
(
key
==
"--src-width"
)
args
.
resized_width
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--src-height"
)
args
.
resized_height
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--hit-threshold"
)
args
.
hit_threshold
=
atof
(
val
.
c_str
());
else
if
(
key
==
"--scale"
)
args
.
scale
=
atof
(
val
.
c_str
());
else
if
(
key
==
"--nlevels"
)
args
.
nlevels
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--win-width"
)
args
.
win_width
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--win-stride-width"
)
args
.
win_stride_width
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--win-stride-height"
)
args
.
win_stride_height
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--gr-threshold"
)
args
.
gr_threshold
=
atoi
(
val
.
c_str
());
else
if
(
key
==
"--gamma-correct"
)
args
.
gamma_corr
=
atoi
(
val
.
c_str
())
!=
0
;
else
throw
runtime_error
((
string
(
"unknown key: "
)
+
key
));
}
cout
<<
"Command args are parsed
\n
"
;
return
settings
;
return
args
;
}
App
::
App
(
const
Settings
&
s
)
App
::
App
(
const
Args
&
s
)
{
settin
gs
=
s
;
ar
gs
=
s
;
cout
<<
"
\n
Controls:
\n
"
<<
"
\t
ESC - exit
\n
"
<<
"
\t
m - change mode GPU <-> CPU
\n
"
...
...
@@ -178,79 +183,81 @@ App::App(const Settings &s)
<<
endl
;
use_gpu
=
true
;
make_gray
=
settin
gs
.
make_gray
;
scale
=
settin
gs
.
scale
;
gr_threshold
=
settin
gs
.
gr_threshold
;
nlevels
=
settin
gs
.
nlevels
;
hit_threshold
=
settin
gs
.
hit_threshold
;
gamma_corr
=
settin
gs
.
gamma_corr
;
make_gray
=
ar
gs
.
make_gray
;
scale
=
ar
gs
.
scale
;
gr_threshold
=
ar
gs
.
gr_threshold
;
nlevels
=
ar
gs
.
nlevels
;
hit_threshold
=
ar
gs
.
hit_threshold
;
gamma_corr
=
ar
gs
.
gamma_corr
;
if
(
settings
.
win_width
!=
64
&&
settin
gs
.
win_width
!=
48
)
settin
gs
.
win_width
=
64
;
if
(
args
.
win_width
!=
64
&&
ar
gs
.
win_width
!=
48
)
ar
gs
.
win_width
=
64
;
cout
<<
"Scale: "
<<
scale
<<
endl
;
if
(
args
.
resize_src
)
cout
<<
"Source size: ("
<<
args
.
resized_width
<<
", "
<<
args
.
resized_height
<<
")
\n
"
;
cout
<<
"Group threshold: "
<<
gr_threshold
<<
endl
;
cout
<<
"Levels number: "
<<
nlevels
<<
endl
;
cout
<<
"Win width: "
<<
settin
gs
.
win_width
<<
endl
;
cout
<<
"Win stride: ("
<<
settings
.
win_stride_width
<<
", "
<<
settin
gs
.
win_stride_height
<<
")
\n
"
;
cout
<<
"Win width: "
<<
ar
gs
.
win_width
<<
endl
;
cout
<<
"Win stride: ("
<<
args
.
win_stride_width
<<
", "
<<
ar
gs
.
win_stride_height
<<
")
\n
"
;
cout
<<
"Hit threshold: "
<<
hit_threshold
<<
endl
;
cout
<<
"Gamma correction: "
<<
gamma_corr
<<
endl
;
cout
<<
endl
;
}
void
App
::
RunOpencvGui
()
void
App
::
run
()
{
running
=
true
;
Size
win_size
(
settings
.
win_width
,
settin
gs
.
win_width
*
2
);
//(64, 128) or (48, 96)
Size
win_stride
(
settings
.
win_stride_width
,
settin
gs
.
win_stride_height
);
Size
win_size
(
args
.
win_width
,
ar
gs
.
win_width
*
2
);
//(64, 128) or (48, 96)
Size
win_stride
(
args
.
win_stride_width
,
ar
gs
.
win_stride_height
);
vector
<
float
>
detector
;
if
(
win_size
==
Size
(
64
,
128
))
if
(
win_size
==
Size
(
64
,
128
))
detector
=
cv
::
gpu
::
HOGDescriptor
::
getPeopleDetector_64x128
();
else
detector
=
cv
::
gpu
::
HOGDescriptor
::
getPeopleDetector_48x96
();
// GPU's HOG classifier
cv
::
gpu
::
HOGDescriptor
gpu_hog
(
win_size
,
Size
(
16
,
16
),
Size
(
8
,
8
),
Size
(
8
,
8
),
9
,
cv
::
gpu
::
HOGDescriptor
::
DEFAULT_WIN_SIGMA
,
0.2
,
gamma_corr
,
cv
::
gpu
::
HOGDescriptor
::
DEFAULT_NLEVELS
);
gpu_hog
.
setSVMDetector
(
detector
);
// CPU's HOG classifier
cv
::
HOGDescriptor
cpu_hog
(
win_size
,
Size
(
16
,
16
),
Size
(
8
,
8
),
Size
(
8
,
8
),
9
,
1
,
-
1
,
HOGDescriptor
::
L2Hys
,
0.2
,
gamma_corr
,
cv
::
HOGDescriptor
::
DEFAULT_NLEVELS
);
gpu_hog
.
setSVMDetector
(
detector
);
cpu_hog
.
setSVMDetector
(
detector
);
#ifdef WRITE_VIDEO
cv
::
VideoWriter
video_writer
;
video_writer
.
open
(
"output.avi"
,
CV_FOURCC
(
'x'
,
'v'
,
'i'
,
'd'
),
24.
,
cv
::
Size
(
640
,
480
),
true
);
if
(
!
video_writer
.
isOpened
())
throw
std
::
runtime_error
(
"can't create video writer"
);
#endif
// Make endless cycle from video (if src is video)
while
(
running
)
{
VideoCapture
vc
;
Mat
frame
;
if
(
settin
gs
.
src_is_video
)
if
(
ar
gs
.
src_is_video
)
{
vc
.
open
(
settin
gs
.
src
.
c_str
());
vc
.
open
(
ar
gs
.
src
.
c_str
());
if
(
!
vc
.
isOpened
())
throw
runtime_error
(
string
(
"Can't open video file: "
+
settings
.
src
));
throw
runtime_error
(
string
(
"can't open video file: "
+
args
.
src
));
vc
>>
frame
;
}
else
if
(
args
.
src_is_camera
)
{
vc
.
open
(
args
.
camera_id
);
if
(
!
vc
.
isOpened
())
throw
runtime_error
(
string
(
"can't open video file: "
+
args
.
src
));
vc
>>
frame
;
}
else
{
frame
=
imread
(
settin
gs
.
src
);
frame
=
imread
(
ar
gs
.
src
);
if
(
frame
.
empty
())
throw
runtime_error
(
string
(
"
Can't open image file: "
+
settin
gs
.
src
));
throw
runtime_error
(
string
(
"
can't open image file: "
+
ar
gs
.
src
));
}
Mat
img_aux
,
img
,
img_to_show
;
...
...
@@ -259,38 +266,34 @@ void App::RunOpencvGui()
// Iterate over all frames
while
(
running
&&
!
frame
.
empty
())
{
WorkBegin
();
vector
<
Rect
>
found
;
workBegin
();
// Change format of the image (input must be 8UC3)
if
(
make_gray
)
cvtColor
(
frame
,
img_aux
,
CV_BGR2GRAY
);
else
if
(
use_gpu
)
cvtColor
(
frame
,
img_aux
,
CV_BGR2BGRA
);
else
img_aux
=
frame
;
// Change format of the image
if
(
make_gray
)
cvtColor
(
frame
,
img_aux
,
CV_BGR2GRAY
);
else
if
(
use_gpu
)
cvtColor
(
frame
,
img_aux
,
CV_BGR2BGRA
);
else
img_aux
=
frame
;
// Resize image
if
(
settings
.
resize_src
)
resize
(
img_aux
,
img
,
Size
(
int
(
frame
.
cols
*
settings
.
resize_src_scale
),
int
(
frame
.
rows
*
settings
.
resize_src_scale
)));
else
img
=
img_aux
;
if
(
args
.
resize_src
)
resize
(
img_aux
,
img
,
Size
(
args
.
resized_width
,
args
.
resized_height
));
else
img
=
img_aux
;
img_to_show
=
img
;
gpu_hog
.
nlevels
=
nlevels
;
cpu_hog
.
nlevels
=
nlevels
;
vector
<
Rect
>
found
;
// Perform HOG classification
H
ogWorkBegin
();
h
ogWorkBegin
();
if
(
use_gpu
)
{
gpu_img
=
img
;
gpu_hog
.
detectMultiScale
(
gpu_img
,
found
,
hit_threshold
,
win_stride
,
Size
(
0
,
0
),
scale
,
gr_threshold
);
gpu_hog
.
detectMultiScale
(
gpu_img
,
found
,
hit_threshold
,
win_stride
,
Size
(
0
,
0
),
scale
,
gr_threshold
);
}
else
cpu_hog
.
detectMultiScale
(
img
,
found
,
hit_threshold
,
win_stride
,
Size
(
0
,
0
),
scale
,
gr_threshold
);
H
ogWorkEnd
();
else
cpu_hog
.
detectMultiScale
(
img
,
found
,
hit_threshold
,
win_stride
,
Size
(
0
,
0
),
scale
,
gr_threshold
);
h
ogWorkEnd
();
// Draw positive classified windows
for
(
size_t
i
=
0
;
i
<
found
.
size
();
i
++
)
...
...
@@ -299,17 +302,14 @@ void App::RunOpencvGui()
rectangle
(
img_to_show
,
r
.
tl
(),
r
.
br
(),
CV_RGB
(
0
,
255
,
0
),
3
);
}
// Show results
putText
(
img_to_show
,
GetPerformanceSummary
(),
Point
(
5
,
25
),
FONT_HERSHEY_SIMPLEX
,
1.0
,
Scalar
(
0
,
0
,
255
),
2
);
putText
(
img_to_show
,
"FPS (HOG only): "
+
hogWorkFps
(),
Point
(
5
,
25
),
FONT_HERSHEY_SIMPLEX
,
1.
,
Scalar
(
255
,
100
,
0
),
2
);
putText
(
img_to_show
,
"FPS (total): "
+
workFps
(),
Point
(
5
,
65
),
FONT_HERSHEY_SIMPLEX
,
1.
,
Scalar
(
255
,
100
,
0
),
2
);
imshow
(
"opencv_gpu_hog"
,
img_to_show
);
H
andleKey
((
char
)
waitKey
(
3
));
h
andleKey
((
char
)
waitKey
(
3
));
if
(
settings
.
src_is_video
)
{
vc
>>
frame
;
}
if
(
args
.
src_is_video
||
args
.
src_is_camera
)
vc
>>
frame
;
W
orkEnd
();
w
orkEnd
();
#ifdef WRITE_VIDEO
cvtColor
(
img_to_show
,
img
,
CV_BGRA2BGR
);
...
...
@@ -320,7 +320,7 @@ void App::RunOpencvGui()
}
void
App
::
H
andleKey
(
char
key
)
void
App
::
h
andleKey
(
char
key
)
{
switch
(
key
)
{
...
...
@@ -382,38 +382,35 @@ void App::HandleKey(char key)
}
inline
void
App
::
H
ogWorkBegin
()
{
hog_work_begin
=
getTickCount
();
}
inline
void
App
::
h
ogWorkBegin
()
{
hog_work_begin
=
getTickCount
();
}
inline
void
App
::
HogWorkEnd
()
inline
void
App
::
hogWorkEnd
()
{
int64
delta
=
getTickCount
()
-
hog_work_begin
;
double
freq
=
getTickFrequency
();
hog_work_fps
=
freq
/
delta
;
}
inline
string
App
::
hogWorkFps
()
const
{
stringstream
ss
;
ss
<<
hog_work_fps
;
return
ss
.
str
();
}
inline
double
App
::
HogWorkFps
()
const
{
return
hog_work_fps
;
}
inline
void
App
::
WorkBegin
()
{
work_begin
=
getTickCount
();
}
inline
void
App
::
workBegin
()
{
work_begin
=
getTickCount
();
}
inline
void
App
::
W
orkEnd
()
inline
void
App
::
w
orkEnd
()
{
int64
delta
=
getTickCount
()
-
work_begin
;
double
freq
=
getTickFrequency
();
work_fps
=
freq
/
delta
;
}
inline
double
App
::
WorkFps
()
const
{
return
work_fps
;
}
inline
const
string
App
::
GetPerformanceSummary
()
const
inline
string
App
::
workFps
()
const
{
stringstream
ss
;
ss
<<
(
use_gpu
?
"GPU"
:
"CPU"
)
<<
" HOG FPS: "
<<
setiosflags
(
ios
::
left
)
<<
setprecision
(
4
)
<<
setw
(
7
)
<<
HogWorkFps
()
<<
" Total FPS: "
<<
setprecision
(
4
)
<<
setw
(
7
)
<<
WorkFps
();
ss
<<
work_fps
;
return
ss
.
str
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录