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
580d8173
Commit
580d8173
authored
Nov 12, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor computing of scaling factor
parent
d3ac2824
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
44 deletions
+9
-44
softcascade.cpp
modules/gpu/src/softcascade.cpp
+9
-44
No files found.
modules/gpu/src/softcascade.cpp
View file @
580d8173
...
...
@@ -70,6 +70,15 @@ cv::gpu::device::icf::Level::Level(int idx, const Octave& oct, const float scale
objSize
.
x
=
cv
::
saturate_cast
<
uchar
>
(
oct
.
size
.
x
*
relScale
);
objSize
.
y
=
cv
::
saturate_cast
<
uchar
>
(
oct
.
size
.
y
*
relScale
);
// according to R. Benenson, M. Mathias, R. Timofte and L. Van Gool's and Dallal's papers
if
(
fabs
(
relScale
-
1.
f
)
<
FLT_EPSILON
)
scaling
[
0
]
=
scaling
[
1
]
=
1.
f
;
else
{
scaling
[
0
]
=
(
relScale
<
1.
f
)
?
0.89
f
*
::
pow
(
relScale
,
1.099
f
/
::
log
(
2
))
:
1.
f
;
scaling
[
1
]
=
relScale
*
relScale
;
}
}
namespace
cv
{
namespace
gpu
{
namespace
device
{
...
...
@@ -91,38 +100,6 @@ namespace imgproc {
struct
cv
::
gpu
::
SCascade
::
Fields
{
struct
CascadeIntrinsics
{
static
const
float
lambda
=
1.099
f
,
a
=
0.89
f
;
static
float
getFor
(
int
channel
,
float
scaling
)
{
CV_Assert
(
channel
<
10
);
if
(
fabs
(
scaling
-
1.
f
)
<
FLT_EPSILON
)
return
1.
f
;
// according to R. Benenson, M. Mathias, R. Timofte and L. Van Gool's and Dallal's papers
static
const
float
A
[
2
][
2
]
=
{
//channel <= 6, otherwise
{
0.89
f
,
1.
f
},
// down
{
1.00
f
,
1.
f
}
// up
};
static
const
float
B
[
2
][
2
]
=
{
//channel <= 6, otherwise
{
1.099
f
/
::
log
(
2
),
2.
f
},
// down
{
0.
f
,
2.
f
}
// up
};
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));
return
a
*
::
pow
(
scaling
,
b
);
}
};
static
Fields
*
parseCascade
(
const
FileNode
&
root
,
const
float
mins
,
const
float
maxs
)
{
static
const
char
*
const
SC_STAGE_TYPE
=
"stageType"
;
...
...
@@ -281,8 +258,6 @@ struct cv::gpu::SCascade::Fields
int
fit
=
fitOctave
(
voctaves
,
logScale
);
Level
level
(
fit
,
voctaves
[
fit
],
scale
,
width
,
height
);
level
.
scaling
[
0
]
=
CascadeIntrinsics
::
getFor
(
0
,
level
.
relScale
);
level
.
scaling
[
1
]
=
CascadeIntrinsics
::
getFor
(
9
,
level
.
relScale
);
if
(
!
width
||
!
height
)
break
;
...
...
@@ -294,16 +269,6 @@ struct cv::gpu::SCascade::Fields
if
(
::
fabs
(
scale
-
maxs
)
<
FLT_EPSILON
)
break
;
scale
=
::
std
::
min
(
maxs
,
::
expf
(
::
log
(
scale
)
+
logFactor
));
// std::cout << "level " << sc
// << " octeve "
// << vlevels[sc].octave
// << " relScale "
// << vlevels[sc].relScale
// << " " << vlevels[sc].shrScale
// << " [" << (int)vlevels[sc].objSize.x
// << " " << (int)vlevels[sc].objSize.y << "] ["
// << (int)vlevels[sc].workRect.x << " " << (int)vlevels[sc].workRect.y << "]" << std::endl;
}
cv
::
Mat
hlevels
(
1
,
vlevels
.
size
()
*
sizeof
(
Level
),
CV_8UC1
,
(
uchar
*
)
&
(
vlevels
[
0
])
);
...
...
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