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
4aac1444
Commit
4aac1444
authored
Sep 20, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
integral channel storage are cached as a cascade's field
parent
1ab7af69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
78 deletions
+92
-78
icf.hpp
modules/gpu/src/icf.hpp
+86
-71
softcascade.cpp
modules/gpu/src/softcascade.cpp
+6
-7
No files found.
modules/gpu/src/icf.hpp
View file @
4aac1444
...
...
@@ -54,79 +54,93 @@
namespace
icf
{
struct
Cascade
using
cv
::
gpu
::
PtrStepSzb
;
using
cv
::
gpu
::
PtrStepSzf
;
struct
Cascade
{
Cascade
()
{}
Cascade
(
const
cv
::
gpu
::
PtrStepSzb
&
octs
,
const
cv
::
gpu
::
PtrStepSzf
&
sts
,
const
cv
::
gpu
::
PtrStepSzb
&
nds
,
const
cv
::
gpu
::
PtrStepSzf
&
lvs
,
const
cv
::
gpu
::
PtrStepSzb
&
fts
,
const
cv
::
gpu
::
PtrStepSzb
&
lls
)
:
octaves
(
octs
),
stages
(
sts
),
nodes
(
nds
),
leaves
(
lvs
),
features
(
fts
),
levels
(
lls
)
{}
PtrStepSzb
octaves
;
PtrStepSzf
stages
;
PtrStepSzb
nodes
;
PtrStepSzf
leaves
;
PtrStepSzb
features
;
PtrStepSzb
levels
;
};
struct
ChannelStorage
{
ChannelStorage
(){}
ChannelStorage
(
const
cv
::
gpu
::
PtrStepSzb
&
buff
,
const
cv
::
gpu
::
PtrStepSzb
&
shr
,
const
cv
::
gpu
::
PtrStepSzb
&
itg
,
const
int
s
)
:
dmem
(
buff
),
shrunk
(
shr
),
hogluv
(
itg
),
shrinkage
(
s
)
{}
void
frame
(
const
cv
::
gpu
::
PtrStepSzb
&
image
)
{}
PtrStepSzb
dmem
;
PtrStepSzb
shrunk
;
PtrStepSzb
hogluv
;
int
shrinkage
;
};
struct
__align__
(
16
)
Octave
{
ushort
index
;
ushort
stages
;
ushort
shrinkage
;
ushort2
size
;
float
scale
;
Octave
(
const
ushort
i
,
const
ushort
s
,
const
ushort
sh
,
const
ushort2
sz
,
const
float
sc
)
:
index
(
i
),
stages
(
s
),
shrinkage
(
sh
),
size
(
sz
),
scale
(
sc
)
{}
};
struct
__align__
(
8
)
Node
{
int
feature
;
float
threshold
;
Node
(
const
int
f
,
const
float
t
)
:
feature
(
f
),
threshold
(
t
)
{}
};
struct
__align__
(
8
)
Feature
{
int
channel
;
uchar4
rect
;
Feature
(
const
int
c
,
const
uchar4
r
)
:
channel
(
c
),
rect
(
r
)
{}
};
struct
__align__
(
8
)
Level
//is actually 24 bytes
{
int
octave
;
// float origScale; //not actually used
float
relScale
;
float
shrScale
;
// used for marking detection
float
scaling
[
2
];
// calculated according to Dollal paper
// for 640x480 we can not get overflow
uchar2
workRect
;
uchar2
objSize
;
Level
(
int
idx
,
const
Octave
&
oct
,
const
float
scale
,
const
int
w
,
const
int
h
)
:
octave
(
idx
),
relScale
(
scale
/
oct
.
scale
),
shrScale
(
relScale
/
(
float
)
oct
.
shrinkage
)
{
Cascade
()
{}
Cascade
(
const
cv
::
gpu
::
PtrStepSzb
&
octs
,
const
cv
::
gpu
::
PtrStepSzf
&
sts
,
const
cv
::
gpu
::
PtrStepSzb
&
nds
,
const
cv
::
gpu
::
PtrStepSzf
&
lvs
,
const
cv
::
gpu
::
PtrStepSzb
&
fts
,
const
cv
::
gpu
::
PtrStepSzb
&
lls
)
:
octaves
(
octs
),
stages
(
sts
),
nodes
(
nds
),
leaves
(
lvs
),
features
(
fts
),
levels
(
lls
)
{}
workRect
.
x
=
round
(
w
/
(
float
)
oct
.
shrinkage
);
workRect
.
y
=
round
(
h
/
(
float
)
oct
.
shrinkage
);
cv
::
gpu
::
PtrStepSzb
octaves
;
cv
::
gpu
::
PtrStepSzf
stages
;
cv
::
gpu
::
PtrStepSzb
nodes
;
cv
::
gpu
::
PtrStepSzf
leaves
;
cv
::
gpu
::
PtrStepSzb
features
;
cv
::
gpu
::
PtrStepSzb
levels
;
};
struct
ChannelStorage
{
ChannelStorage
(
const
cv
::
gpu
::
PtrStepSzb
&
/*f*/
,
const
int
/*shrinkage*/
)
{}
};
struct
__align__
(
16
)
Octave
{
ushort
index
;
ushort
stages
;
ushort
shrinkage
;
ushort2
size
;
float
scale
;
Octave
(
const
ushort
i
,
const
ushort
s
,
const
ushort
sh
,
const
ushort2
sz
,
const
float
sc
)
:
index
(
i
),
stages
(
s
),
shrinkage
(
sh
),
size
(
sz
),
scale
(
sc
)
{}
};
struct
__align__
(
8
)
Node
{
int
feature
;
float
threshold
;
Node
(
const
int
f
,
const
float
t
)
:
feature
(
f
),
threshold
(
t
)
{}
};
struct
__align__
(
8
)
Feature
{
int
channel
;
uchar4
rect
;
Feature
(
const
int
c
,
const
uchar4
r
)
:
channel
(
c
),
rect
(
r
)
{}
};
struct
__align__
(
8
)
Level
//is actually 24 bytes
{
int
octave
;
// float origScale; //not actually used
float
relScale
;
float
shrScale
;
// used for marking detection
float
scaling
[
2
];
// calculated according to Dollal paper
// for 640x480 we can not get overflow
uchar2
workRect
;
uchar2
objSize
;
Level
(
int
idx
,
const
Octave
&
oct
,
const
float
scale
,
const
int
w
,
const
int
h
)
:
octave
(
idx
),
relScale
(
scale
/
oct
.
scale
),
shrScale
(
relScale
/
(
float
)
oct
.
shrinkage
)
{
workRect
.
x
=
round
(
w
/
(
float
)
oct
.
shrinkage
);
workRect
.
y
=
round
(
h
/
(
float
)
oct
.
shrinkage
);
objSize
.
x
=
round
(
oct
.
size
.
x
*
relScale
);
objSize
.
y
=
round
(
oct
.
size
.
y
*
relScale
);
}
};
objSize
.
x
=
round
(
oct
.
size
.
x
*
relScale
);
objSize
.
y
=
round
(
oct
.
size
.
y
*
relScale
);
}
};
}
#endif
\ No newline at end of file
modules/gpu/src/softcascade.cpp
View file @
4aac1444
...
...
@@ -84,9 +84,10 @@ struct cv::gpu::SoftCascade::Filds
std
::
vector
<
float
>
scales
;
icf
::
Cascade
cascade
;
icf
::
ChannelStorage
storage
;
bool
fill
(
const
FileNode
&
root
,
const
float
mins
,
const
float
maxs
);
void
detect
(
const
icf
::
ChannelStorage
&
/*channels*/
)
const
{}
void
detect
()
const
{}
enum
{
BOOST
=
0
};
enum
...
...
@@ -281,6 +282,7 @@ inline bool cv::gpu::SoftCascade::Filds::fill(const FileNode &root, const float
shrunk
.
create
(
FRAME_HEIGHT
/
shrinkage
*
HOG_LUV_BINS
,
FRAME_WIDTH
/
shrinkage
,
CV_8UC1
);
hogluv
.
create
(
(
FRAME_HEIGHT
/
shrinkage
*
HOG_LUV_BINS
)
+
1
,
(
FRAME_WIDTH
/
shrinkage
)
+
1
,
CV_16UC1
);
storage
=
icf
::
ChannelStorage
(
dmem
,
shrunk
,
hogluv
,
shrinkage
);
return
true
;
}
...
...
@@ -398,13 +400,10 @@ void cv::gpu::SoftCascade::detectMultiScale(const GpuMat& image, const GpuMat& /
// only this window size allowed
CV_Assert
(
image
.
cols
==
640
&&
image
.
rows
==
480
);
Filds
&
flds
=
*
filds
;
// ToDo: add shrincage in whole cascade.
const
int
shrincage
=
4
;
icf
::
ChannelStorage
storage
(
image
,
shrincage
);
const
Filds
&
flds
=
*
filds
;
flds
.
detect
(
storage
);
flds
.
storage
.
frame
(
image
);
flds
.
detect
();
}
#endif
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