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
b0b85f36
Commit
b0b85f36
authored
Sep 05, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for soft cascade detect method
parent
f01c5d90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
objdetect.hpp
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
+8
-2
softcascade.cpp
modules/objdetect/src/softcascade.cpp
+10
-3
test_softcascade.cpp
modules/objdetect/test/test_softcascade.cpp
+20
-0
No files found.
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
View file @
b0b85f36
...
@@ -493,12 +493,18 @@ protected:
...
@@ -493,12 +493,18 @@ protected:
class
CV_EXPORTS
SoftCascade
class
CV_EXPORTS
SoftCascade
{
{
public
:
public
:
//! empty cascade will be created.
SoftCascade
();
SoftCascade
();
//! cascade will be loaded from file "filename"
SoftCascade
(
const
string
&
filename
,
const
float
minScale
=
0.4
f
,
const
float
maxScale
=
5.
f
);
SoftCascade
(
const
string
&
filename
,
const
float
minScale
=
0.4
f
,
const
float
maxScale
=
5.
f
);
virtual
~
SoftCascade
();
bool
load
(
const
string
&
filename
,
const
float
minScale
=
0.4
f
,
const
float
maxScale
=
5.
f
);
bool
load
(
const
string
&
filename
,
const
float
minScale
=
0.4
f
,
const
float
maxScale
=
5.
f
);
virtual
void
detectMultiScale
(
const
Mat
&
image
,
const
std
::
vector
<
cv
::
Rect
>&
rois
,
std
::
vector
<
cv
::
Rect
>&
objects
,
double
factor
=
1.05
,
int
step
=
4
,
int
rejectfactor
=
1
);
virtual
~
SoftCascade
();
//! return vector of bounding boxes. Each box contains detected object
virtual
void
detectMultiScale
(
const
Mat
&
image
,
const
std
::
vector
<
cv
::
Rect
>&
rois
,
std
::
vector
<
cv
::
Rect
>&
objects
,
int
step
=
4
,
int
rejectfactor
=
1
);
protected
:
protected
:
virtual
void
detectForOctave
(
int
octave
);
virtual
void
detectForOctave
(
int
octave
);
...
...
modules/objdetect/src/softcascade.cpp
View file @
b0b85f36
...
@@ -319,14 +319,20 @@ bool cv::SoftCascade::load( const string& filename, const float minScale, const
...
@@ -319,14 +319,20 @@ bool cv::SoftCascade::load( const string& filename, const float minScale, const
filds
=
new
Filds
;
filds
=
new
Filds
;
Filds
&
flds
=
*
filds
;
Filds
&
flds
=
*
filds
;
if
(
!
flds
.
fill
(
fs
.
getFirstTopLevelNode
(),
minScale
,
maxScale
))
return
false
;
if
(
!
flds
.
fill
(
fs
.
getFirstTopLevelNode
(),
minScale
,
maxScale
))
return
false
;
//
flds.calcLevels(FRAME_WIDTH, FRAME_HEIGHT, TOTAL_SCALES);
flds
.
calcLevels
(
FRAME_WIDTH
,
FRAME_HEIGHT
,
TOTAL_SCALES
);
return
true
;
return
true
;
}
}
void
cv
::
SoftCascade
::
detectMultiScale
(
const
Mat
&
image
,
const
std
::
vector
<
cv
::
Rect
>&
rois
,
std
::
vector
<
cv
::
Rect
>&
objects
,
void
cv
::
SoftCascade
::
detectMultiScale
(
const
Mat
&
image
,
const
std
::
vector
<
cv
::
Rect
>&
rois
,
std
::
vector
<
cv
::
Rect
>&
objects
,
const
double
factor
,
const
int
step
,
const
int
rejectfactor
)
const
int
step
,
const
int
rejectfactor
)
{}
{
// only color images are supperted
CV_Assert
(
image
.
type
()
==
CV_8UC3
);
// only this window size allowed
CV_Assert
(
image
.
cols
==
640
&&
image
.
rows
==
480
);
}
void
cv
::
SoftCascade
::
detectForOctave
(
const
int
octave
)
void
cv
::
SoftCascade
::
detectForOctave
(
const
int
octave
)
{}
{}
\ No newline at end of file
modules/objdetect/test/test_softcascade.cpp
View file @
b0b85f36
...
@@ -47,4 +47,23 @@ TEST(SoftCascade, readCascade)
...
@@ -47,4 +47,23 @@ TEST(SoftCascade, readCascade)
cv
::
SoftCascade
cascade
;
cv
::
SoftCascade
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
xml
));
ASSERT_TRUE
(
cascade
.
load
(
xml
));
}
TEST
(
SoftCascade
,
Detect
)
{
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/softcascade.xml"
;
std
::
cout
<<
"PATH: "
<<
xml
<<
std
::
endl
;
cv
::
SoftCascade
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
xml
));
cv
::
Mat
colored
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/bahnhof/image_00000006_0.png"
);
ASSERT_FALSE
(
colored
.
empty
());
std
::
vector
<
cv
::
Rect
>
objectBoxes
;
std
::
vector
<
cv
::
Rect
>
rois
;
rois
.
push_back
(
cv
::
Rect
(
0
,
0
,
640
,
480
));
ASSERT_NO_THROW
(
{
cascade
.
detectMultiScale
(
colored
,
rois
,
objectBoxes
);
});
}
}
\ 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