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
a53f0f39
Commit
a53f0f39
authored
Jul 04, 2012
by
Marina Kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LBP classifier: tracking of count of detected objects was moved in cascadeclassifier.cpp
parent
0ee2662d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
30 deletions
+32
-30
cascadeclassifier.cpp
modules/gpu/src/cascadeclassifier.cpp
+25
-18
lbp.cu
modules/gpu/src/cuda/lbp.cu
+7
-12
No files found.
modules/gpu/src/cascadeclassifier.cpp
View file @
a53f0f39
...
...
@@ -273,21 +273,22 @@ namespace cv { namespace gpu { namespace device
{
namespace
lbp
{
int
classifyStump
(
const
DevMem2Db
mstages
,
const
int
nstages
,
const
DevMem2Di
mnodes
,
const
DevMem2Df
mleaves
,
const
DevMem2Di
msubsets
,
const
DevMem2Db
mfeatures
,
const
DevMem2Di
integral
,
const
int
workWidth
,
const
int
workHeight
,
const
int
clWidth
,
const
int
clHeight
,
float
scale
,
int
step
,
int
subsetSize
,
DevMem2D_
<
int4
>
objects
);
classifyStump
(
const
DevMem2Db
mstages
,
const
int
nstages
,
const
DevMem2Di
mnodes
,
const
DevMem2Df
mleaves
,
const
DevMem2Di
msubsets
,
const
DevMem2Db
mfeatures
,
const
DevMem2Di
integral
,
const
int
workWidth
,
const
int
workHeight
,
const
int
clWidth
,
const
int
clHeight
,
float
scale
,
int
step
,
int
subsetSize
,
DevMem2D_
<
int4
>
objects
,
unsigned
int
*
classified
);
}
}}}
...
...
@@ -308,6 +309,11 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
maxObjectSize
=
image
.
size
();
scaledImageBuffer
.
create
(
image
.
rows
+
1
,
image
.
cols
+
1
,
CV_8U
);
unsigned
int
*
classified
=
new
unsigned
int
[
1
];
*
classified
=
0
;
unsigned
int
*
dclassified
;
cudaMalloc
(
&
dclassified
,
sizeof
(
int
));
cudaMemcpy
(
dclassified
,
classified
,
sizeof
(
int
),
cudaMemcpyHostToDevice
);
for
(
double
factor
=
1
;
;
factor
*=
scaleFactor
)
{
...
...
@@ -331,10 +337,11 @@ int cv::gpu::CascadeClassifier_GPU_LBP::detectMultiScale(const GpuMat& image, Gp
int
step
=
(
factor
<=
2.
)
+
1
;
int
res
=
cv
::
gpu
::
device
::
lbp
::
classifyStump
(
stage_mat
,
stage_mat
.
cols
/
sizeof
(
Stage
),
nodes_mat
,
leaves_mat
,
subsets_mat
,
features_mat
,
integral
,
processingRectSize
.
width
,
processingRectSize
.
height
,
windowSize
.
width
,
windowSize
.
height
,
scaleFactor
,
step
,
subsetSize
,
objects
);
std
::
cout
<<
res
<<
"Results: "
<<
cv
::
Mat
(
objects
).
row
(
0
).
colRange
(
0
,
res
)
<<
std
::
endl
;
cv
::
gpu
::
device
::
lbp
::
classifyStump
(
stage_mat
,
stage_mat
.
cols
/
sizeof
(
Stage
),
nodes_mat
,
leaves_mat
,
subsets_mat
,
features_mat
,
integral
,
processingRectSize
.
width
,
processingRectSize
.
height
,
windowSize
.
width
,
windowSize
.
height
,
scaleFactor
,
step
,
subsetSize
,
objects
,
dclassified
);
}
cudaMemcpy
(
classified
,
dclassified
,
sizeof
(
int
),
cudaMemcpyDeviceToHost
);
std
::
cout
<<
*
classified
<<
"Results: "
<<
cv
::
Mat
(
objects
).
row
(
0
).
colRange
(
0
,
*
classified
)
<<
std
::
endl
;
// TODO: reject levels
return
0
;
...
...
modules/gpu/src/cuda/lbp.cu
View file @
a53f0f39
...
...
@@ -51,8 +51,6 @@ namespace cv { namespace gpu { namespace device
{
int y = threadIdx.x * scale;
int x = blockIdx.x * scale;
*n = 0;
int i = 0;
int current_node = 0;
int current_leave = 0;
...
...
@@ -77,7 +75,6 @@ namespace cv { namespace gpu { namespace device
current_leave += 2;
}
i = s;
if (sum < stage.threshold)
return;
}
...
...
@@ -88,29 +85,26 @@ namespace cv { namespace gpu { namespace device
rect.z = roundf(clWidth);
rect.w = roundf(clHeight);
int res = atomicInc(n, 100
0
);
int res = atomicInc(n, 100);
objects(0, res) = rect;
}
int
classifyStump(const DevMem2Db mstages, const int nstages, const DevMem2Di mnodes, const DevMem2Df mleaves, const DevMem2Di msubsets, const DevMem2Db mfeatures,
classifyStump(const DevMem2Db mstages, const int nstages, const DevMem2Di mnodes, const DevMem2Df mleaves, const DevMem2Di msubsets, const DevMem2Db mfeatures,
const DevMem2Di integral, const int workWidth, const int workHeight, const int clWidth, const int clHeight, float scale, int step, int subsetSize,
DevMem2D_<int4> objects)
DevMem2D_<int4> objects
, unsigned int* classified
)
{
int blocks = ceilf(workHeight / (float)step);
int threads = ceilf(workWidth / (float)step);
printf("blocks %d, threads %d\n", blocks, threads);
//
printf("blocks %d, threads %d\n", blocks, threads);
Stage* stages = (Stage*)(mstages.ptr());
ClNode* nodes = (ClNode*)(mnodes.ptr());
const float* leaves = mleaves.ptr();
const int* subsets = msubsets.ptr();
const uchar4* features = (uchar4*)(mfeatures.ptr());
unsigned int * n, *h_n = new unsigned int[1];
cudaMalloc(&n, sizeof(int));
lbp_classify_stump<<<blocks, threads>>>(stages, nstages, nodes, leaves, subsets, features, integral,
workWidth, workHeight, clWidth, clHeight, scale, step, subsetSize, objects, n);
cudaMemcpy(h_n, n, sizeof(int), cudaMemcpyDeviceToHost);
return *h_n;
workWidth, workHeight, clWidth, clHeight, scale, step, subsetSize, objects, classified);
}
}
}}}
\ No newline at end of file
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