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
7a785597
Commit
7a785597
authored
Dec 06, 2013
by
Konstantin Matskevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes
parent
0a1ff0d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
facedetect.cpp
samples/ocl/facedetect.cpp
+16
-3
No files found.
samples/ocl/facedetect.cpp
View file @
7a785597
...
...
@@ -74,7 +74,7 @@ static int facedetect_one_thread(bool useCPU, double scale )
if
(
!
cascade
.
load
(
cascadeName
)
||
!
cpu_cascade
.
load
(
cascadeName
)
)
{
cout
<<
"ERROR: Could not load classifier cascade
"
<<
endl
;
cout
<<
"ERROR: Could not load classifier cascade
: "
<<
cascadeName
<<
endl
;
return
EXIT_FAILURE
;
}
...
...
@@ -170,7 +170,12 @@ static int facedetect_one_thread(bool useCPU, double scale )
static
void
detectFaces
(
std
::
string
fileName
)
{
ocl
::
OclCascadeClassifier
cascade
;
cascade
.
load
(
cascadeName
);
if
(
!
cascade
.
load
(
cascadeName
))
{
std
::
cout
<<
"ERROR: Could not load classifier cascade: "
<<
cascadeName
<<
std
::
endl
;
return
;
}
Mat
img
=
imread
(
fileName
,
CV_LOAD_IMAGE_COLOR
);
if
(
img
.
empty
())
{
...
...
@@ -187,8 +192,16 @@ static void detectFaces(std::string fileName)
for
(
unsigned
int
i
=
0
;
i
<
oclfaces
.
size
();
i
++
)
rectangle
(
img
,
Point
(
oclfaces
[
i
].
x
,
oclfaces
[
i
].
y
),
Point
(
oclfaces
[
i
].
x
+
oclfaces
[
i
].
width
,
oclfaces
[
i
].
y
+
oclfaces
[
i
].
height
),
Scalar
(
0
,
255
,
255
),
3
);
imwrite
(
std
::
to_string
(
_threadid
)
+
outputName
,
img
);
int
n
=
(
int
)
outputName
.
length
();
while
(
n
>
0
&&
outputName
[
n
-
1
]
!=
'.'
)
n
--
;
if
(
n
==
0
)
{
std
::
cout
<<
"Invalid output file name: "
<<
outputName
<<
std
::
endl
;
return
;
}
imwrite
(
outputName
.
substr
(
0
,
n
-
1
)
+
"_"
+
std
::
to_string
(
_threadid
)
+
outputName
.
substr
(
n
-
1
,
outputName
.
length
()
-
1
),
img
);
}
static
void
facedetect_multithreading
(
int
nthreads
)
...
...
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