Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
b0af6a2b
Commit
b0af6a2b
authored
Jan 16, 2014
by
Roman Donchenko
Committed by
OpenCV Buildbot
Jan 16, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2127 from apavlenko:perf_cascades
parents
a164381c
c7d90c8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
56 deletions
+61
-56
perf_cascades.cpp
modules/objdetect/perf/opencl/perf_cascades.cpp
+61
-0
perf_cascadeclassifier.cpp
modules/objdetect/perf/perf_cascadeclassifier.cpp
+0
-56
No files found.
modules/objdetect/perf/opencl/perf_cascades.cpp
0 → 100644
View file @
b0af6a2b
#include "perf_precomp.hpp"
#include <opencv2/imgproc.hpp>
#include "opencv2/ts/ocl_perf.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
std
::
tr1
::
tuple
<
std
::
string
,
std
::
string
,
int
>
Cascade_Image_MinSize_t
;
typedef
perf
::
TestBaseWithParam
<
Cascade_Image_MinSize_t
>
Cascade_Image_MinSize
;
#ifdef HAVE_OPENCL
OCL_PERF_TEST_P
(
Cascade_Image_MinSize
,
CascadeClassifier
,
testing
::
Combine
(
testing
::
Values
(
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt.xml"
),
string
(
"cv/cascadeandhog/cascades/haarcascade_frontalface_alt_old.xml"
),
string
(
"cv/cascadeandhog/cascades/lbpcascade_frontalface.xml"
)
),
testing
::
Values
(
string
(
"cv/shared/lena.png"
),
string
(
"cv/cascadeandhog/images/bttf301.png"
),
string
(
"cv/cascadeandhog/images/class57.png"
)
),
testing
::
Values
(
30
,
64
,
90
)
)
)
{
const
string
cascasePath
=
get
<
0
>
(
GetParam
());
const
string
imagePath
=
get
<
1
>
(
GetParam
());
int
min_size
=
get
<
2
>
(
GetParam
());
Size
minSize
(
min_size
,
min_size
);
CascadeClassifier
cc
(
getDataPath
(
cascasePath
)
);
if
(
cc
.
empty
())
FAIL
()
<<
"Can't load cascade file: "
<<
getDataPath
(
cascasePath
);
Mat
img
=
imread
(
getDataPath
(
imagePath
),
IMREAD_GRAYSCALE
);
if
(
img
.
empty
())
FAIL
()
<<
"Can't load source image: "
<<
getDataPath
(
imagePath
);
vector
<
Rect
>
faces
;
equalizeHist
(
img
,
img
);
declare
.
in
(
img
).
time
(
60
);
UMat
uimg
=
img
.
getUMat
(
ACCESS_READ
);
while
(
next
())
{
faces
.
clear
();
cvtest
::
ocl
::
perf
::
safeFinish
();
startTimer
();
cc
.
detectMultiScale
(
uimg
,
faces
,
1.1
,
3
,
0
,
minSize
);
stopTimer
();
}
sort
(
faces
.
begin
(),
faces
.
end
(),
comparators
::
RectLess
());
SANITY_CHECK
(
faces
,
min_size
/
5
);
}
#endif //HAVE_OPENCL
modules/objdetect/perf/perf_cascadeclassifier.cpp
deleted
100644 → 0
View file @
a164381c
#include "perf_precomp.hpp"
#include <opencv2/imgproc.hpp>
using
namespace
std
;
using
namespace
cv
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
std
::
tr1
::
tuple
<
std
::
string
,
int
>
ImageName_MinSize_t
;
typedef
perf
::
TestBaseWithParam
<
ImageName_MinSize_t
>
ImageName_MinSize
;
PERF_TEST_P
(
ImageName_MinSize
,
CascadeClassifierLBPFrontalFace
,
testing
::
Combine
(
testing
::
Values
(
std
::
string
(
"cv/shared/lena.png"
),
std
::
string
(
"cv/shared/1_itseez-0000289.png"
),
std
::
string
(
"cv/shared/1_itseez-0000492.png"
),
std
::
string
(
"cv/shared/1_itseez-0000573.png"
)),
testing
::
Values
(
24
,
30
,
40
,
50
,
60
,
70
,
80
,
90
)
)
)
{
const
string
filename
=
get
<
0
>
(
GetParam
());
int
min_size
=
get
<
1
>
(
GetParam
());
Size
minSize
(
min_size
,
min_size
);
CascadeClassifier
cc
(
getDataPath
(
"cv/cascadeandhog/cascades/lbpcascade_frontalface.xml"
));
if
(
cc
.
empty
())
FAIL
()
<<
"Can't load cascade file"
;
Mat
img
=
imread
(
getDataPath
(
filename
),
0
);
if
(
img
.
empty
())
FAIL
()
<<
"Can't load source image"
;
vector
<
Rect
>
faces
;
equalizeHist
(
img
,
img
);
declare
.
in
(
img
);
while
(
next
())
{
faces
.
clear
();
startTimer
();
cc
.
detectMultiScale
(
img
,
faces
,
1.1
,
3
,
0
,
minSize
);
stopTimer
();
}
// for some reason OpenCL version detects the face, which CPU version does not detect, we just remove it
// TODO better solution: implement smart way of comparing two set of rectangles
if
(
filename
==
"cv/shared/1_itseez-0000492.png"
&&
faces
.
size
()
==
(
size_t
)
3
)
{
faces
.
erase
(
faces
.
begin
());
}
std
::
sort
(
faces
.
begin
(),
faces
.
end
(),
comparators
::
RectLess
());
SANITY_CHECK
(
faces
,
3.001
*
faces
.
size
());
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment