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
14a0dd8c
Commit
14a0dd8c
authored
Sep 21, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typo in cascade loading
parent
a3af5ede
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
softcascade.cpp
modules/gpu/src/softcascade.cpp
+16
-17
test_softcascade.cpp
modules/gpu/test/test_softcascade.cpp
+4
-3
No files found.
modules/gpu/src/softcascade.cpp
View file @
14a0dd8c
...
...
@@ -198,11 +198,11 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
FileNode
fns
=
*
it
;
float
scale
=
(
float
)
fns
[
SC_OCT_SCALE
];
scales
.
push_back
(
scale
);
ushort
nstages
=
saturate_cast
<
ushort
>
((
int
)
fn
[
SC_OCT_STAGES
]);
ushort
nstages
=
saturate_cast
<
ushort
>
((
int
)
fn
s
[
SC_OCT_STAGES
]);
ushort2
size
;
size
.
x
=
cvRound
(
ORIG_OBJECT_WIDTH
*
scale
);
size
.
y
=
cvRound
(
ORIG_OBJECT_HEIGHT
*
scale
);
shrinkage
=
saturate_cast
<
ushort
>
((
int
)
fn
[
SC_OCT_SHRINKAGE
]);
shrinkage
=
saturate_cast
<
ushort
>
((
int
)
fn
s
[
SC_OCT_SHRINKAGE
]);
icf
::
Octave
octave
(
octIndex
,
nstages
,
shrinkage
,
size
,
scale
);
CV_Assert
(
octave
.
stages
>
0
);
...
...
@@ -219,7 +219,7 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
for
(;
st
!=
st_end
;
++
st
)
{
fns
=
*
st
;
vstages
.
push_back
((
float
)
fn
[
SC_STAGE_THRESHOLD
]);
vstages
.
push_back
((
float
)
fn
s
[
SC_STAGE_THRESHOLD
]);
fns
=
fns
[
SC_WEEK
];
FileNodeIterator
ftr
=
fns
.
begin
(),
ft_end
=
fns
.
end
();
...
...
@@ -230,7 +230,8 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
for
(;
inIt
!=
inIt_end
;)
{
int
feature
=
(
int
)(
*
(
inIt
+=
2
)
++
)
+
feature_offset
;
vnodes
.
push_back
(
icf
::
Node
(
feature
,
(
float
)(
*
(
inIt
++
))));
float
th
=
(
float
)(
*
(
inIt
++
));
vnodes
.
push_back
(
icf
::
Node
(
feature
,
th
));
}
fns
=
(
*
ftr
)[
SC_LEAF
];
...
...
@@ -277,7 +278,7 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
calcLevels
(
voctaves
,
FRAME_WIDTH
,
FRAME_HEIGHT
,
TOTAL_SCALES
);
CV_Assert
(
!
levels
.
empty
());
//
init Cascade
//init Cascade
cascade
=
icf
::
Cascade
(
octaves
,
stages
,
nodes
,
leaves
,
features
,
levels
);
// allocate buffers
...
...
@@ -317,7 +318,7 @@ namespace {
float
a
=
A
[(
int
)(
scaling
>=
1
)][(
int
)(
channel
>
6
)];
float
b
=
B
[(
int
)(
scaling
>=
1
)][(
int
)(
channel
>
6
)];
printf
(
"!!! scaling: %f %f %f -> %f
\n
"
,
scaling
,
a
,
b
,
a
*
pow
(
scaling
,
b
));
//
printf("!!! scaling: %f %f %f -> %f\n", scaling, a, b, a * pow(scaling, b));
return
a
*
pow
(
scaling
,
b
);
}
};
...
...
@@ -352,19 +353,17 @@ inline void cv::gpu::SoftCascade::Filds::calcLevels(const std::vector<icf::Octav
if
(
::
fabs
(
scale
-
maxScale
)
<
FLT_EPSILON
)
break
;
scale
=
::
std
::
min
(
maxScale
,
::
expf
(
::
log
(
scale
)
+
logFactor
));
levels
.
upload
(
cv
::
Mat
(
1
,
vlevels
.
size
()
*
sizeof
(
icf
::
Level
),
CV_8UC1
,
(
uchar
*
)
&
(
vlevels
[
0
])
));
// std::cout << "level " << sc << " scale "
// << levels[sc].origScale
// std::cout << "level " << sc
// << " octeve "
// <<
levels[sc].octave->scal
e
// << " "
// << levels[sc].relScale
// << " " << levels[sc].shrScale
// << " [" <<
levels[sc].objSize.width
// << " " <<
levels[sc].objSize.height
<< "] ["
// <<
levels[sc].workRect.width << " " << levels[sc].workRect.height
<< "]" << std::endl;
// <<
vlevels[sc].octav
e
// << "
relScale
"
// <<
v
levels[sc].relScale
// << " " <<
v
levels[sc].shrScale
// << " [" <<
(int)vlevels[sc].objSize.x
// << " " <<
(int)vlevels[sc].objSize.y
<< "] ["
// <<
(int)vlevels[sc].workRect.x << " " << (int)vlevels[sc].workRect.y
<< "]" << std::endl;
}
levels
.
upload
(
cv
::
Mat
(
1
,
vlevels
.
size
()
*
sizeof
(
icf
::
Level
),
CV_8UC1
,
(
uchar
*
)
&
(
vlevels
[
0
])
));
}
cv
::
gpu
::
SoftCascade
::
SoftCascade
()
:
filds
(
0
)
{}
...
...
modules/gpu/test/test_softcascade.cpp
View file @
14a0dd8c
...
...
@@ -48,7 +48,7 @@ using cv::gpu::GpuMat;
TEST
(
SoftCascade
,
readCascade
)
{
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/icf-template.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
../cv/
cascadeandhog/icf-template.xml"
;
cv
::
gpu
::
SoftCascade
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
xml
));
...
...
@@ -56,11 +56,12 @@ TEST(SoftCascade, readCascade)
TEST
(
SoftCascade
,
detect
)
{
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/sc_cvpr_2012_to_opencv.xml"
;
std
::
string
xml
=
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"
../cv/
cascadeandhog/sc_cvpr_2012_to_opencv.xml"
;
cv
::
gpu
::
SoftCascade
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
xml
));
cv
::
Mat
coloredCpu
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"cascadeandhog/bahnhof/image_00000000_0.png"
);
cv
::
Mat
coloredCpu
=
cv
::
imread
(
cvtest
::
TS
::
ptr
()
->
get_data_path
()
+
"../cv/cascadeandhog/bahnhof/image_00000000_0.png"
);
ASSERT_FALSE
(
coloredCpu
.
empty
());
GpuMat
colored
(
coloredCpu
),
objectBoxes
,
rois
;
...
...
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