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
c4f88b06
Commit
c4f88b06
authored
Jul 23, 2013
by
lluis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed some unnecessary ERStat members as they are easily computable from others
parent
43e7e6e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
erfilter.hpp
modules/objdetect/include/opencv2/objdetect/erfilter.hpp
+2
-7
erfilter.cpp
modules/objdetect/src/erfilter.cpp
+11
-8
No files found.
modules/objdetect/include/opencv2/objdetect/erfilter.hpp
View file @
c4f88b06
...
...
@@ -79,13 +79,8 @@ public:
Rect
rect
;
double
raw_moments
[
2
];
//!< order 1 raw moments to derive the centroid
double
central_moments
[
3
];
//!< order 2 central moments to construct the covariance matrix
std
::
deque
<
int
>
*
crossings
;
//!< horizontal crossings
//! 1st stage features
float
aspect_ratio
;
float
compactness
;
float
num_holes
;
float
med_crossings
;
std
::
deque
<
int
>
*
crossings
;
//!< horizontal crossings
float
med_crossings
;
//!< median of the crossings at three different height levels
//! 2nd stage features
float
hole_area_ratio
;
...
...
modules/objdetect/src/erfilter.cpp
View file @
c4f88b06
...
...
@@ -611,11 +611,6 @@ void ERFilterNM::er_merge(ERStat *parent, ERStat *child)
parent
->
central_moments
[
1
]
+=
child
->
central_moments
[
1
];
parent
->
central_moments
[
2
]
+=
child
->
central_moments
[
2
];
// child region done, we can calculate 1st stage features from the incrementally computable descriptors
child
->
aspect_ratio
=
(
float
)(
child
->
rect
.
width
)
/
(
child
->
rect
.
height
);
child
->
compactness
=
sqrt
((
float
)(
child
->
area
))
/
child
->
perimeter
;
child
->
num_holes
=
(
float
)(
1
-
child
->
euler
);
vector
<
int
>
m_crossings
;
m_crossings
.
push_back
(
child
->
crossings
->
at
((
int
)(
child
->
rect
.
height
)
/
6
));
m_crossings
.
push_back
(
child
->
crossings
->
at
((
int
)
3
*
(
child
->
rect
.
height
)
/
6
));
...
...
@@ -1004,7 +999,11 @@ ERClassifierNM1::ERClassifierNM1()
double
ERClassifierNM1
::
eval
(
const
ERStat
&
stat
)
{
//Classify
float
arr
[]
=
{
0
,
stat
.
aspect_ratio
,
stat
.
compactness
,
stat
.
num_holes
,
stat
.
med_crossings
};
float
arr
[]
=
{
0
,(
float
)(
stat
.
rect
.
width
)
/
(
stat
.
rect
.
height
),
// aspect ratio
sqrt
((
float
)(
stat
.
area
))
/
stat
.
perimeter
,
// compactness
(
float
)(
1
-
stat
.
euler
),
//number of holes
stat
.
med_crossings
};
vector
<
float
>
sample
(
arr
,
arr
+
sizeof
(
arr
)
/
sizeof
(
arr
[
0
])
);
float
votes
=
boost
.
predict
(
Mat
(
sample
),
Mat
(),
Range
::
all
(),
false
,
true
);
...
...
@@ -1038,8 +1037,12 @@ ERClassifierNM2::ERClassifierNM2()
double
ERClassifierNM2
::
eval
(
const
ERStat
&
stat
)
{
//Classify
float
arr
[]
=
{
0
,
stat
.
aspect_ratio
,
stat
.
compactness
,
stat
.
num_holes
,
stat
.
med_crossings
,
stat
.
hole_area_ratio
,
stat
.
convex_hull_ratio
,
stat
.
num_inflexion_points
};
float
arr
[]
=
{
0
,(
float
)(
stat
.
rect
.
width
)
/
(
stat
.
rect
.
height
),
// aspect ratio
sqrt
((
float
)(
stat
.
area
))
/
stat
.
perimeter
,
// compactness
(
float
)(
1
-
stat
.
euler
),
//number of holes
stat
.
med_crossings
,
stat
.
hole_area_ratio
,
stat
.
convex_hull_ratio
,
stat
.
num_inflexion_points
};
vector
<
float
>
sample
(
arr
,
arr
+
sizeof
(
arr
)
/
sizeof
(
arr
[
0
])
);
float
votes
=
boost
.
predict
(
Mat
(
sample
),
Mat
(),
Range
::
all
(),
false
,
true
);
...
...
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