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
0c6c78d1
Commit
0c6c78d1
authored
Dec 19, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integrate 128x256 scale; remove log
parent
e09694bd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
33 deletions
+6
-33
softcascade.cpp
modules/objdetect/src/softcascade.cpp
+6
-33
No files found.
modules/objdetect/src/softcascade.cpp
View file @
0c6c78d1
...
...
@@ -139,8 +139,6 @@ struct Level
workRect
(
cv
::
Size
(
cvRound
(
w
/
(
float
)
shrinkage
),
cvRound
(
h
/
(
float
)
shrinkage
))),
objSize
(
cv
::
Size
(
cvRound
(
oct
.
size
.
width
*
relScale
),
cvRound
(
oct
.
size
.
height
*
relScale
)))
{
std
::
cout
<<
"Level "
<<
oct
.
scale
<<
" "
<<
scale
<<
" "
<<
shrinkage
<<
" "
<<
w
<<
" "
<<
h
<<
std
::
endl
;
scaling
[
0
]
=
((
relScale
>=
1.
f
)
?
1.
f
:
(
0.89
f
*
pow
(
relScale
,
1.099
f
/
log
(
2.
f
))))
/
(
relScale
*
relScale
);
scaling
[
1
]
=
1.
f
;
scaleshift
=
static_cast
<
int
>
(
relScale
*
(
1
<<
16
));
...
...
@@ -259,10 +257,7 @@ struct cv::SCascade::Fields
cv
::
Rect
scaledRect
(
feature
.
rect
);
float
threshold
=
level
.
rescale
(
scaledRect
,
node
.
threshold
,(
int
)(
feature
.
channel
>
6
))
*
feature
.
rarea
;
float
sum
=
storage
.
get
(
feature
.
channel
,
scaledRect
);
// std::cout << "root: node.threshold " << node.threshold << " " << threshold << " " << sum << " node.feature " << node.feature << " " << feature.rect << std::endl;
int
next
=
(
sum
>=
threshold
)
?
2
:
1
;
// leaves
...
...
@@ -271,18 +266,13 @@ struct cv::SCascade::Fields
scaledRect
=
fLeaf
.
rect
;
threshold
=
level
.
rescale
(
scaledRect
,
leaf
.
threshold
,
(
int
)(
fLeaf
.
channel
>
6
))
*
fLeaf
.
rarea
;
sum
=
storage
.
get
(
fLeaf
.
channel
,
scaledRect
);
// std::cout << "leaf: node.threshold " << leaf.threshold << " " << threshold << " " << sum << " node.feature " << leaf.feature << " " << fLeaf.rect << std::endl;
int
lShift
=
(
next
-
1
)
*
2
+
((
sum
>=
threshold
)
?
1
:
0
);
float
impact
=
leaves
[(
st
*
4
+
offset
)
+
lShift
];
// std::cout << "impact " << impact;
detectionScore
+=
impact
;
}
// std::cout << dx << " " << dy << " " << detectionScore << " " << stage.threshold << std::endl;
if
(
detectionScore
<=
stage
.
threshold
)
return
;
}
...
...
@@ -379,7 +369,6 @@ struct cv::SCascade::Fields
FileNode
fn
=
root
[
SC_OCTAVES
];
if
(
fn
.
empty
())
return
false
;
// // octaves.reserve(noctaves);
FileNodeIterator
it
=
fn
.
begin
(),
it_end
=
fn
.
end
();
int
feature_offset
=
0
;
int
octIndex
=
0
;
...
...
@@ -400,7 +389,6 @@ struct cv::SCascade::Fields
// for each tree (~ decision tree with H = 2)
FileNodeIterator
st
=
fns
.
begin
(),
st_end
=
fns
.
end
();
// int i = 0;
for
(;
st
!=
st_end
;
++
st
)
{
stages
.
push_back
(
Weak
(
*
st
));
...
...
@@ -412,16 +400,9 @@ struct cv::SCascade::Fields
fns
=
(
*
st
)[
SC_LEAF
];
inIt
=
fns
.
begin
(),
inIt_end
=
fns
.
end
();
// int l = 0;
for
(;
inIt
!=
inIt_end
;
++
inIt
)
{
leaves
.
push_back
((
float
)(
*
inIt
));
// l++;
// std::cout << ((float)(*inIt)) << std::endl;
}
// if (l =! 4) std::cout << "!!!!!!! " << i << std::endl;
// i++;
// std::cout << i << " nodes " << nodes.size() << " " << nodes.size() / 3.0 << std::endl;
}
st
=
ffs
.
begin
(),
st_end
=
ffs
.
end
();
...
...
@@ -430,15 +411,7 @@ struct cv::SCascade::Fields
feature_offset
+=
octave
.
weaks
*
3
;
++
octIndex
;
std
::
cout
<<
"octaves "
<<
octaves
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"stages "
<<
stages
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"nodes "
<<
nodes
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"leaves "
<<
leaves
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"features "
<<
features
.
size
()
<<
std
::
endl
;
}
// exit(0);
return
true
;
}
};
...
...
@@ -519,14 +492,12 @@ void cv::SCascade::detectNoRoi(const cv::Mat& image, std::vector<Detection>& obj
ChannelStorage
storage
(
image
,
fld
.
shrinkage
);
typedef
std
::
vector
<
Level
>::
const_iterator
lIt
;
int
i
=
13
;
for
(
lIt
it
=
fld
.
levels
.
begin
();
it
!=
fld
.
levels
.
end
();
++
it
)
{
const
Level
&
level
=
*
it
;
if
(
level
.
octave
->
index
!=
2
)
continue
;
std
::
cout
<<
level
.
origScale
<<
std
::
endl
;
// we train only 3 scales.
if
(
level
.
origScale
>
2.5
)
break
;
for
(
int
dy
=
0
;
dy
<
level
.
workRect
.
height
;
++
dy
)
{
...
...
@@ -534,7 +505,6 @@ void cv::SCascade::detectNoRoi(const cv::Mat& image, std::vector<Detection>& obj
{
storage
.
offset
=
dy
*
storage
.
step
+
dx
;
fld
.
detectAt
(
dx
,
dy
,
level
,
storage
,
objects
);
// std::cout << std::endl << std::endl << std::endl;
}
}
}
...
...
@@ -574,6 +544,9 @@ void cv::SCascade::detect(cv::InputArray _image, cv::InputArray _rois, std::vect
{
const
Level
&
level
=
*
it
;
// we train only 3 scales.
if
(
level
.
origScale
>
2.5
)
break
;
for
(
int
dy
=
0
;
dy
<
level
.
workRect
.
height
;
++
dy
)
{
uchar
*
m
=
mask
.
ptr
<
uchar
>
(
dy
);
...
...
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