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
e15bdea6
Commit
e15bdea6
authored
Jan 18, 2013
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test for new cascade
parent
53433884
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
19 deletions
+38
-19
perf_cascadeclassifier.cpp
modules/objdetect/perf/perf_cascadeclassifier.cpp
+8
-7
test_softcascade.cpp
modules/objdetect/test/test_softcascade.cpp
+30
-12
No files found.
modules/objdetect/perf/perf_cascadeclassifier.cpp
View file @
e15bdea6
...
@@ -54,19 +54,20 @@ typedef perf::TestBaseWithParam<fixture> detect;
...
@@ -54,19 +54,20 @@ typedef perf::TestBaseWithParam<fixture> detect;
namespace
{
namespace
{
typedef
cv
::
SCascade
::
Detection
detection_t
;
typedef
cv
::
SCascade
::
Detection
detection_t
;
void
extractRacts
(
std
::
vector
<
detection_t
>
objectBoxes
,
vector
<
Rect
>
rects
)
void
extractRacts
(
std
::
vector
<
detection_t
>
objectBoxes
,
vector
<
Rect
>&
rects
)
{
{
rects
.
clear
();
rects
.
clear
();
for
(
int
i
=
0
;
i
<
(
int
)
objectBoxes
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
objectBoxes
.
size
();
++
i
)
rects
.
push_back
(
objectBoxes
[
i
].
bb
);
rects
.
push_back
(
objectBoxes
[
i
].
bb
);
}
}
}
}
PERF_TEST_P
(
detect
,
SCascade
,
PERF_TEST_P
(
detect
,
SCascade
,
testing
::
Combine
(
testing
::
Values
(
std
::
string
(
"cv/
softcascade/soft-cascade-17.12.2012
.xml"
)),
testing
::
Combine
(
testing
::
Values
(
std
::
string
(
"cv/
cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
)),
testing
::
Values
(
std
::
string
(
"cv/
softcascade/bahnhof
/image_00000000_0.png"
))))
testing
::
Values
(
std
::
string
(
"cv/
cascadeandhog/images
/image_00000000_0.png"
))))
{
{
typedef
cv
::
SCascade
::
Detection
Detection
;
typedef
cv
::
SCascade
::
Detection
Detection
;
cv
::
Mat
colored
=
imread
(
getDataPath
(
get
<
1
>
(
GetParam
())));
cv
::
Mat
colored
=
imread
(
getDataPath
(
get
<
1
>
(
GetParam
())));
...
...
modules/objdetect/test/test_softcascade.cpp
View file @
e15bdea6
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
TEST
(
SCascade
,
readCascade
)
TEST
(
SCascade
,
readCascade
)
{
{
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/soft-cascade-17.12.2012
.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
;
cv
::
SCascade
cascade
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
fs
.
isOpened
());
ASSERT_TRUE
(
fs
.
isOpened
());
...
@@ -57,46 +57,46 @@ TEST(SCascade, readCascade)
...
@@ -57,46 +57,46 @@ TEST(SCascade, readCascade)
TEST
(
SCascade
,
detect
)
TEST
(
SCascade
,
detect
)
{
{
typedef
cv
::
SCascade
::
Detection
Detection
;
typedef
cv
::
SCascade
::
Detection
Detection
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"softcascade/soft-cascade-17.12.2012
.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
;
cv
::
SCascade
cascade
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"softcascade/bahnhof
/image_00000000_0.png"
);
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/images
/image_00000000_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
ASSERT_FALSE
(
colored
.
empty
());
std
::
vector
<
Detection
>
objects
;
std
::
vector
<
Detection
>
objects
;
cascade
.
detect
(
colored
,
cv
::
noArray
(),
objects
);
cascade
.
detect
(
colored
,
cv
::
noArray
(),
objects
);
ASSERT_EQ
(
823
,
(
int
)
objects
.
size
());
ASSERT_EQ
(
719
,
(
int
)
objects
.
size
());
}
}
TEST
(
SCascade
,
detectSeparate
)
TEST
(
SCascade
,
detectSeparate
)
{
{
typedef
cv
::
SCascade
::
Detection
Detection
;
typedef
cv
::
SCascade
::
Detection
Detection
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/soft-cascade-17.12.2012
.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
;
cv
::
SCascade
cascade
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/bahnhof
/image_00000000_0.png"
);
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/images
/image_00000000_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
ASSERT_FALSE
(
colored
.
empty
());
cv
::
Mat
rects
,
confs
;
cv
::
Mat
rects
,
confs
;
cascade
.
detect
(
colored
,
cv
::
noArray
(),
rects
,
confs
);
cascade
.
detect
(
colored
,
cv
::
noArray
(),
rects
,
confs
);
ASSERT_EQ
(
823
,
confs
.
cols
);
ASSERT_EQ
(
719
,
confs
.
cols
);
}
}
TEST
(
SCascade
,
detectRoi
)
TEST
(
SCascade
,
detectRoi
)
{
{
typedef
cv
::
SCascade
::
Detection
Detection
;
typedef
cv
::
SCascade
::
Detection
Detection
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/soft-cascade-17.12.2012
.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
;
cv
::
SCascade
cascade
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/bahnhof
/image_00000000_0.png"
);
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/images
/image_00000000_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
ASSERT_FALSE
(
colored
.
empty
());
std
::
vector
<
Detection
>
objects
;
std
::
vector
<
Detection
>
objects
;
...
@@ -104,18 +104,18 @@ TEST(SCascade, detectRoi)
...
@@ -104,18 +104,18 @@ TEST(SCascade, detectRoi)
rois
.
push_back
(
cv
::
Rect
(
0
,
0
,
640
,
480
));
rois
.
push_back
(
cv
::
Rect
(
0
,
0
,
640
,
480
));
cascade
.
detect
(
colored
,
rois
,
objects
);
cascade
.
detect
(
colored
,
rois
,
objects
);
ASSERT_EQ
(
823
,
(
int
)
objects
.
size
());
ASSERT_EQ
(
719
,
(
int
)
objects
.
size
());
}
}
TEST
(
SCascade
,
detectNoRoi
)
TEST
(
SCascade
,
detectNoRoi
)
{
{
typedef
cv
::
SCascade
::
Detection
Detection
;
typedef
cv
::
SCascade
::
Detection
Detection
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/soft-cascade-17.12.2012
.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/cascades/inria_caltech-17.01.2013
.xml"
;
cv
::
SCascade
cascade
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
softcascade/bahnhof
/image_00000000_0.png"
);
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
cascadeandhog/images
/image_00000000_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
ASSERT_FALSE
(
colored
.
empty
());
std
::
vector
<
Detection
>
objects
;
std
::
vector
<
Detection
>
objects
;
...
@@ -123,5 +123,22 @@ TEST(SCascade, detectNoRoi)
...
@@ -123,5 +123,22 @@ TEST(SCascade, detectNoRoi)
cascade
.
detect
(
colored
,
rois
,
objects
);
cascade
.
detect
(
colored
,
rois
,
objects
);
ASSERT_EQ
(
719
,
(
int
)
objects
.
size
());
}
TEST
(
SCascade
,
detectEmptyRoi
)
{
typedef
cv
::
SCascade
::
Detection
Detection
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/cascades/inria_caltech-17.01.2013.xml"
;
cv
::
SCascade
cascade
;
cv
::
FileStorage
fs
(
xml
,
cv
::
FileStorage
::
READ
);
ASSERT_TRUE
(
cascade
.
load
(
fs
.
getFirstTopLevelNode
()));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/images/image_00000000_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
std
::
vector
<
Detection
>
objects
;
cascade
.
detect
(
colored
,
cv
::
Mat
::
zeros
(
colored
.
size
(),
CV_8UC1
),
objects
);
ASSERT_EQ
(
0
,
(
int
)
objects
.
size
());
ASSERT_EQ
(
0
,
(
int
)
objects
.
size
());
}
}
\ No newline at end of file
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