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
2e8ed773
Commit
2e8ed773
authored
Oct 25, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get rid of hard-coded values
parent
16dd09cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
23 deletions
+16
-23
objdetect.hpp
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
+0
-12
softcascade.cpp
modules/objdetect/src/softcascade.cpp
+16
-11
No files found.
modules/objdetect/include/opencv2/objdetect/objdetect.hpp
View file @
2e8ed773
...
...
@@ -529,18 +529,6 @@ public:
virtual
void
detectMultiScale
(
const
Mat
&
image
,
const
std
::
vector
<
cv
::
Rect
>&
rois
,
std
::
vector
<
Detection
>&
objects
,
int
rejectfactor
=
1
)
const
;
protected
:
enum
{
BOOST
=
0
};
enum
{
FRAME_WIDTH
=
640
,
FRAME_HEIGHT
=
480
,
TOTAL_SCALES
=
55
,
CLASSIFIERS
=
5
,
ORIG_OBJECT_WIDTH
=
64
,
ORIG_OBJECT_HEIGHT
=
128
};
private
:
struct
Filds
;
Filds
*
filds
;
...
...
modules/objdetect/src/softcascade.cpp
View file @
2e8ed773
...
...
@@ -270,6 +270,10 @@ struct cv::SoftCascade::Filds
std
::
vector
<
Level
>
levels
;
cv
::
Size
frameSize
;
enum
{
BOOST
=
0
};
typedef
std
::
vector
<
Octave
>::
iterator
octIt_t
;
void
detectAt
(
const
int
dx
,
const
int
dy
,
const
Level
&
level
,
const
ChannelStorage
&
storage
,
...
...
@@ -364,8 +368,11 @@ struct cv::SoftCascade::Filds
}
// compute levels of full pyramid
void
calcLevels
(
int
frameW
,
int
frameH
,
int
scales
)
void
calcLevels
(
const
cv
::
Size
&
curr
,
int
scales
)
{
if
(
frameSize
==
curr
)
return
;
frameSize
=
curr
;
CV_Assert
(
scales
>
1
);
levels
.
clear
();
float
logFactor
=
(
log
(
maxScale
)
-
log
(
minScale
))
/
(
scales
-
1
);
...
...
@@ -373,8 +380,8 @@ struct cv::SoftCascade::Filds
float
scale
=
minScale
;
for
(
int
sc
=
0
;
sc
<
scales
;
++
sc
)
{
int
width
=
std
::
max
(
0.0
f
,
frame
W
-
(
origObjWidth
*
scale
));
int
height
=
std
::
max
(
0.0
f
,
frame
H
-
(
origObjHeight
*
scale
));
int
width
=
std
::
max
(
0.0
f
,
frame
Size
.
width
-
(
origObjWidth
*
scale
));
int
height
=
std
::
max
(
0.0
f
,
frame
Size
.
height
-
(
origObjHeight
*
scale
));
float
logScale
=
log
(
scale
);
octIt_t
fit
=
fitOctave
(
logScale
);
...
...
@@ -434,11 +441,8 @@ struct cv::SoftCascade::Filds
string
featureTypeStr
=
(
string
)
root
[
SC_FEATURE_TYPE
];
CV_Assert
(
featureTypeStr
==
SC_ICF
);
origObjWidth
=
(
int
)
root
[
SC_ORIG_W
];
CV_Assert
(
origObjWidth
==
SoftCascade
::
ORIG_OBJECT_WIDTH
);
origObjWidth
=
(
int
)
root
[
SC_ORIG_W
];
origObjHeight
=
(
int
)
root
[
SC_ORIG_H
];
CV_Assert
(
origObjHeight
==
SoftCascade
::
ORIG_OBJECT_HEIGHT
);
// for each octave (~ one cascade in classic OpenCV xml)
FileNode
fn
=
root
[
SC_OCTAVES
];
...
...
@@ -451,7 +455,7 @@ struct cv::SoftCascade::Filds
for
(;
it
!=
it_end
;
++
it
)
{
FileNode
fns
=
*
it
;
Octave
octave
(
octIndex
,
cv
::
Size
(
SoftCascade
::
ORIG_OBJECT_WIDTH
,
SoftCascade
::
ORIG_OBJECT_HEIGHT
),
fns
);
Octave
octave
(
octIndex
,
cv
::
Size
(
origObjWidth
,
origObjHeight
),
fns
);
CV_Assert
(
octave
.
stages
>
0
);
octaves
.
push_back
(
octave
);
...
...
@@ -520,7 +524,7 @@ bool cv::SoftCascade::read( const cv::FileStorage& fs)
filds
=
new
Filds
;
Filds
&
flds
=
*
filds
;
if
(
!
flds
.
fill
(
fs
.
getFirstTopLevelNode
(),
minScale
,
maxScale
))
return
false
;
flds
.
calcLevels
(
FRAME_WIDTH
,
FRAME_HEIGHT
,
TOTAL_SCALES
);
// flds.calcLevels(FRAME_WIDTH, FRAME_HEIGHT, scales
);
return
true
;
}
...
...
@@ -534,9 +538,10 @@ void cv::SoftCascade::detectMultiScale(const Mat& image, const std::vector<cv::R
// only this window size allowed
CV_Assert
(
image
.
cols
==
640
&&
image
.
rows
==
480
);
objects
.
clear
();
Filds
&
fld
=
*
filds
;
fld
.
calcLevels
(
image
.
size
(),
scales
);
const
Filds
&
fld
=
*
filds
;
objects
.
clear
()
;
// create integrals
ChannelStorage
storage
(
image
,
fld
.
shrinkage
);
...
...
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