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
143c5706
Commit
143c5706
authored
Jun 25, 2012
by
Marina Kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LBP classifier represintation in GPU memory
parent
4a0249f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
22 deletions
+28
-22
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+6
-7
cascadeclassifier.cpp
modules/gpu/src/cascadeclassifier.cpp
+22
-15
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
143c5706
...
...
@@ -1450,14 +1450,13 @@ private:
cv
::
Size
NxM
;
bool
isStumps
;
int
ncategories
;
struct
Stage
;
// Stage* stages;
struct
DTree
;
// DTree* classifiers;
struct
DTreeNode
;
// DTreeNode* nodes;
// located on gpu
GpuMat
stage_mat
;
GpuMat
trees_mat
;
GpuMat
nodes_mat
;
GpuMat
leaves_mat
;
GpuMat
subsets_mat
;
};
////////////////////////////////// SURF //////////////////////////////////////////
...
...
modules/gpu/src/cascadeclassifier.cpp
View file @
143c5706
...
...
@@ -48,7 +48,7 @@ using namespace cv;
using
namespace
cv
::
gpu
;
using
namespace
std
;
struct
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
Stage
struct
Stage
{
int
first
;
int
ntrees
;
...
...
@@ -56,13 +56,7 @@ struct cv::gpu::CascadeClassifier_GPU_LBP::Stage
Stage
(
int
f
=
0
,
int
n
=
0
,
float
t
=
0.
f
)
:
first
(
f
),
ntrees
(
n
),
threshold
(
t
)
{}
};
struct
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
DTree
{
int
nodeCount
;
DTree
(
int
n
=
0
)
:
nodeCount
(
n
)
{}
};
struct
cv
::
gpu
::
CascadeClassifier_GPU_LBP
::
DTreeNode
struct
DTreeNode
{
int
featureIdx
;
//float threshold; // for ordered features only
...
...
@@ -162,7 +156,7 @@ bool CascadeClassifier_GPU_LBP::read(const FileNode &root)
std
::
vector
<
Stage
>
stages
;
stages
.
reserve
(
fn
.
size
());
std
::
vector
<
DTree
>
cl_trees
;
std
::
vector
<
int
>
cl_trees
;
std
::
vector
<
DTreeNode
>
cl_nodes
;
std
::
vector
<
float
>
cl_leaves
;
std
::
vector
<
int
>
subsets
;
...
...
@@ -196,15 +190,14 @@ bool CascadeClassifier_GPU_LBP::read(const FileNode &root)
FileNode
leafValues
=
fnw
[
GPU_CC_LEAF_VALUES
];
if
(
internalNodes
.
empty
()
||
leafValues
.
empty
()
)
return
false
;
int
nodeCount
=
(
int
)
internalNodes
.
size
()
/
nodeStep
;
cl_trees
.
push_back
(
nodeCount
);
DTree
tree
((
int
)
internalNodes
.
size
()
/
nodeStep
);
cl_trees
.
push_back
(
tree
);
cl_nodes
.
reserve
(
cl_nodes
.
size
()
+
tree
.
nodeCount
);
cl_nodes
.
reserve
(
cl_nodes
.
size
()
+
nodeCount
);
cl_leaves
.
reserve
(
cl_leaves
.
size
()
+
leafValues
.
size
());
if
(
subsetSize
>
0
)
subsets
.
reserve
(
subsets
.
size
()
+
tree
.
nodeCount
*
subsetSize
);
subsets
.
reserve
(
subsets
.
size
()
+
nodeCount
*
subsetSize
);
// nodes
FileNodeIterator
iIt
=
internalNodes
.
begin
(),
iEnd
=
internalNodes
.
end
();
...
...
@@ -226,7 +219,21 @@ bool CascadeClassifier_GPU_LBP::read(const FileNode &root)
}
}
// copy data structures on gpu
// GpuMat stages;
stage_mat
=
cv
::
gpu
::
GpuMat
(
1
,
(
int
)
stages
.
size
()
*
sizeof
(
Stage
),
CV_8UC1
);
stage_mat
.
upload
(
cv
::
Mat
(
1
,
stages
.
size
()
*
sizeof
(
Stage
),
CV_8UC1
,
&
(
stages
[
0
])
));
trees_mat
=
cv
::
gpu
::
GpuMat
(
1
,
(
int
)
cl_trees
.
size
(),
CV_32SC1
);
stage_mat
.
upload
(
cv
::
Mat
(
cl_trees
));
nodes_mat
=
cv
::
gpu
::
GpuMat
(
1
,
(
int
)
cl_nodes
.
size
()
*
sizeof
(
DTreeNode
),
CV_8UC1
);
stage_mat
.
upload
(
cv
::
Mat
(
1
,
cl_nodes
.
size
()
*
sizeof
(
DTreeNode
),
CV_8UC1
,
&
(
cl_nodes
[
0
])
));
leaves_mat
=
cv
::
gpu
::
GpuMat
(
1
,
(
int
)
cl_leaves
.
size
(),
CV_32FC1
);
stage_mat
.
upload
(
cv
::
Mat
(
cl_leaves
));
subsets_mat
=
cv
::
gpu
::
GpuMat
(
1
,
(
int
)
subsets
.
size
(),
CV_32SC1
);
stage_mat
.
upload
(
cv
::
Mat
(
subsets
));
return
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