Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
face-detection
Project
Overview
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Снитко
face-detection
Commits
f022eeb7
Commit
f022eeb7
authored
Jun 23, 2017
by
Евгений Снитко
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stop device correctly
parent
d47ca0b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
face.cpp
face.cpp
+20
-5
No files found.
face.cpp
View file @
f022eeb7
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include <unistd.h>
#include <unistd.h>
#include <stdio.h>
#include <stdio.h>
#include <thread>
using
namespace
std
;
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
;
...
@@ -44,6 +45,7 @@ std::function<void(std::string, int)> *faceCheckCallback;
...
@@ -44,6 +45,7 @@ std::function<void(std::string, int)> *faceCheckCallback;
FaceDetection
::
Mode
newMode
;
FaceDetection
::
Mode
newMode
;
bool
started
=
false
;
bool
started
=
false
;
bool
looping
=
false
;
struct
facePosition
{
int
x
,
y
,
width
,
height
;
};
struct
facePosition
{
int
x
,
y
,
width
,
height
;
};
...
@@ -71,7 +73,7 @@ void FaceDetector::Start(
...
@@ -71,7 +73,7 @@ void FaceDetector::Start(
faceCheckCallback
=
&
checkCallback
;
faceCheckCallback
=
&
checkCallback
;
faceFrameReadyCallback
=
&
faceCallback
;
faceFrameReadyCallback
=
&
faceCallback
;
if
(
!
started
)
if
(
!
looping
)
{
{
started
=
true
;
started
=
true
;
Loop
();
Loop
();
...
@@ -80,8 +82,9 @@ void FaceDetector::Start(
...
@@ -80,8 +82,9 @@ void FaceDetector::Start(
///
///
///
///
void
FaceDetector
::
Stop
()
{
void
FaceDetector
::
Stop
()
started
=
false
;
{
started
=
false
;
}
}
///
///
...
@@ -145,6 +148,7 @@ int Loop()
...
@@ -145,6 +148,7 @@ int Loop()
device
->
start
();
device
->
start
();
int
trainClock
=
0
;
int
trainClock
=
0
;
looping
=
true
;
while
(
started
)
while
(
started
)
{
{
FaceDetection
::
Mode
currentMode
=
newMode
;
FaceDetection
::
Mode
currentMode
=
newMode
;
...
@@ -251,7 +255,7 @@ int Loop()
...
@@ -251,7 +255,7 @@ int Loop()
{
{
writePLY
(
model
,
filename
.
c_str
());
writePLY
(
model
,
filename
.
c_str
());
printf
(
"train switch, filename: %s
\n
"
,
filename
.
c_str
());
printf
(
"train switch, filename: %s
\n
"
,
filename
.
c_str
());
(
*
faceSaveCallback
)(
filename
);
(
*
faceSaveCallback
)(
filename
);
printf
(
"callback fired"
);
printf
(
"callback fired"
);
newMode
=
IDLE
;
newMode
=
IDLE
;
...
@@ -282,7 +286,18 @@ int Loop()
...
@@ -282,7 +286,18 @@ int Loop()
}
}
}
}
device
->
stop
();
if
(
device
->
is_streaming
())
device
->
stop
();
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
100
));
for
(
int
j
=
0
;
j
<
4
;
++
j
)
{
auto
s
=
(
rs
::
stream
)
j
;
if
(
device
->
is_stream_enabled
(
s
))
device
->
disable_stream
(
s
);
}
looping
=
false
;
return
0
;
return
0
;
}
}
...
...
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