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
1b7ad93d
Commit
1b7ad93d
authored
Jul 24, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LBP features integrated in CascadeClassifier_GPU
parent
2dc93574
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
44 deletions
+31
-44
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+20
-34
perf_objdetect.cpp
modules/gpu/perf/perf_objdetect.cpp
+1
-1
cascadeclassifier.cpp
modules/gpu/src/cascadeclassifier.cpp
+0
-0
lbp.cu
modules/gpu/src/cuda/lbp.cu
+1
-0
test_objdetect.cpp
modules/gpu/test/test_objdetect.cpp
+9
-9
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
1b7ad93d
...
...
@@ -1397,7 +1397,7 @@ public:
};
////////////////////////////////// CascadeClassifier_GPU //////////////////////////////////////////
// The cascade classifier class for object detection
.
// The cascade classifier class for object detection
: supports old haar and new lbp xlm formats and nvbin for haar cascades olny.
class
CV_EXPORTS
CascadeClassifier_GPU
{
public
:
...
...
@@ -1407,42 +1407,28 @@ public:
bool
empty
()
const
;
bool
load
(
const
std
::
string
&
filename
);
void
release
();
/* returns number of detected objects */
int
detectMultiScale
(
const
GpuMat
&
image
,
GpuMat
&
objectsBuf
,
double
scaleFactor
=
1.2
,
int
minNeighbors
=
4
,
Size
minSize
=
Size
());
bool
findLargestObject
;
bool
visualizeInPlace
;
Size
getClassifierSize
()
const
;
private
:
struct
CascadeClassifierImpl
;
CascadeClassifierImpl
*
impl
;
};
// The cascade classifier class for object detection.
class
CV_EXPORTS
CascadeClassifier_GPU_LBP
{
public
:
CascadeClassifier_GPU_LBP
(
cv
::
Size
detectionFrameSize
=
cv
::
Size
());
~
CascadeClassifier_GPU_LBP
();
bool
empty
()
const
;
bool
load
(
const
std
::
string
&
filename
);
void
release
();
int
detectMultiScale
(
const
GpuMat
&
image
,
GpuMat
&
objectsBuf
,
double
scaleFactor
=
1.1
,
int
minNeighbors
=
4
,
cv
::
Size
maxObjectSize
=
cv
::
Size
()
/*, Size minSize = Size()*/
);
Size
getClassifierSize
()
const
;
void
release
();
private
:
/* returns number of detected objects */
int
detectMultiScale
(
const
GpuMat
&
image
,
GpuMat
&
objectsBuf
,
double
scaleFactor
=
1.2
,
int
minNeighbors
=
4
,
Size
minSize
=
Size
());
bool
findLargestObject
;
bool
visualizeInPlace
;
Size
getClassifierSize
()
const
;
private
:
struct
CascadeClassifierImpl
;
CascadeClassifierImpl
*
impl
;
};
////////////////////////////////// SURF //////////////////////////////////////////
struct
HaarCascade
;
struct
LbpCascade
;
friend
class
CascadeClassifier_GPU_LBP
;
public
:
int
detectMultiScale
(
const
GpuMat
&
image
,
GpuMat
&
objectsBuf
,
Size
maxObjectSize
,
Size
minSize
=
Size
(),
double
scaleFactor
=
1.1
,
int
minNeighbors
=
4
);
};
////////////////////////////////// SURF //////////////////////////////////////////
class
CV_EXPORTS
SURF_GPU
{
...
...
modules/gpu/perf/perf_objdetect.cpp
View file @
1b7ad93d
...
...
@@ -70,7 +70,7 @@ GPU_PERF_TEST_1(LBPClassifier, cv::gpu::DeviceInfo)
cv
::
gpu
::
GpuMat
img
(
img_host
);
cv
::
gpu
::
GpuMat
gpu_rects
;
cv
::
gpu
::
CascadeClassifier_GPU
_LBP
cascade
(
img
.
size
());
cv
::
gpu
::
CascadeClassifier_GPU
cascade
;
ASSERT_TRUE
(
cascade
.
load
(
perf
::
TestBase
::
getDataPath
(
"gpu/lbpcascade/lbpcascade_frontalface.xml"
)));
cascade
.
detectMultiScale
(
img
,
gpu_rects
);
...
...
modules/gpu/src/cascadeclassifier.cpp
View file @
1b7ad93d
This diff is collapsed.
Click to expand it.
modules/gpu/src/cuda/lbp.cu
View file @
1b7ad93d
...
...
@@ -290,6 +290,7 @@ namespace cv { namespace gpu { namespace device
{
const int block = 128;
int grid = divUp(workAmount, block);
cudaFuncSetCacheConfig(lbp_cascade, cudaFuncCachePreferL1);
Cascade cascade((Stage*)mstages.ptr(), nstages, (ClNode*)mnodes.ptr(), mleaves.ptr(), msubsets.ptr(), (uchar4*)mfeatures.ptr(), subsetSize);
lbp_cascade<<<grid, block>>>(cascade, frameW, frameH, windowW, windowH, initialScale, factor, workAmount, integral.ptr(), integral.step / sizeof(int), objects, classified);
}
...
...
modules/gpu/test/test_objdetect.cpp
View file @
1b7ad93d
...
...
@@ -302,13 +302,13 @@ PARAM_TEST_CASE(LBP_Read_classifier, cv::gpu::DeviceInfo, int)
TEST_P
(
LBP_Read_classifier
,
Accuracy
)
{
cv
::
gpu
::
CascadeClassifier_GPU
_LBP
classifier
;
cv
::
gpu
::
CascadeClassifier_GPU
classifier
;
std
::
string
classifierXmlPath
=
std
::
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"lbpcascade/lbpcascade_frontalface.xml"
;
ASSERT_TRUE
(
classifier
.
load
(
classifierXmlPath
));
}
INSTANTIATE_TEST_CASE_P
(
GPU_ObjDetect
,
LBP_Read_classifier
,
testing
::
Combine
(
ALL_DEVICES
,
testing
::
Values
<
int
>
(
0
)));
INSTANTIATE_TEST_CASE_P
(
GPU_ObjDetect
,
LBP_Read_classifier
,
testing
::
Combine
(
ALL_DEVICES
,
testing
::
Values
<
int
>
(
0
)));
PARAM_TEST_CASE
(
LBP_classify
,
cv
::
gpu
::
DeviceInfo
,
int
)
...
...
@@ -344,7 +344,7 @@ TEST_P(LBP_classify, Accuracy)
for
(;
it
!=
rects
.
end
();
++
it
)
cv
::
rectangle
(
markedImage
,
*
it
,
CV_RGB
(
0
,
0
,
255
));
cv
::
gpu
::
CascadeClassifier_GPU
_LBP
gpuClassifier
;
cv
::
gpu
::
CascadeClassifier_GPU
gpuClassifier
;
ASSERT_TRUE
(
gpuClassifier
.
load
(
classifierXmlPath
));
cv
::
gpu
::
GpuMat
gpu_rects
;
...
...
@@ -352,23 +352,23 @@ TEST_P(LBP_classify, Accuracy)
int
count
=
gpuClassifier
.
detectMultiScale
(
tested
,
gpu_rects
);
cv
::
Mat
downloaded
(
gpu_rects
);
const
cv
::
Rect
*
faces
=
downloaded
.
ptr
<
cv
::
Rect
>
();
const
cv
::
Rect
*
faces
=
downloaded
.
ptr
<
cv
::
Rect
>
();
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
cv
::
Rect
r
=
faces
[
i
];
#if defined (LOG_CASCADE_STATISTIC)
std
::
cout
<<
r
.
x
<<
" "
<<
r
.
y
<<
" "
<<
r
.
width
<<
" "
<<
r
.
height
<<
std
::
endl
;
#endif
std
::
cout
<<
r
.
x
<<
" "
<<
r
.
y
<<
" "
<<
r
.
width
<<
" "
<<
r
.
height
<<
std
::
endl
;
cv
::
rectangle
(
markedImage
,
r
,
CV_RGB
(
255
,
0
,
0
));
#endif
}
#if defined (LOG_CASCADE_STATISTIC)
cv
::
imshow
(
"Res"
,
markedImage
);
cv
::
waitKey
();
cv
::
imshow
(
"Res"
,
markedImage
);
cv
::
waitKey
();
#endif
}
INSTANTIATE_TEST_CASE_P
(
GPU_ObjDetect
,
LBP_classify
,
testing
::
Combine
(
ALL_DEVICES
,
testing
::
Values
<
int
>
(
0
)));
testing
::
Combine
(
ALL_DEVICES
,
testing
::
Values
<
int
>
(
0
)));
}
// namespace
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