Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wangquyuan
/
ygydserver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c866715e
authored
Aug 18, 2022
by
wangquyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add by wqy
1 parent
744458c2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
build/config.json
src/include/config.h
src/src/config.cpp
src/src/do_request.cpp
build/config.json
View file @
c866715
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
"work_timeout"
:
10
,
"work_timeout"
:
10
,
"logpath"
:
"/tmp"
,
"logpath"
:
"/tmp"
,
"frame_fps"
:
25
,
"device"
:
"gpu"
,
"device"
:
"gpu"
,
"models"
:
{
"models"
:
{
...
...
src/include/config.h
View file @
c866715
...
@@ -49,6 +49,7 @@ public:
...
@@ -49,6 +49,7 @@ public:
//JSONField( self, MysqlConfig, db );
//JSONField( self, MysqlConfig, db );
JSONField
(
self
,
int
,
frame_fps
)
=
25
;
JSONField
(
self
,
std
::
string
,
device
)
=
"cpu"
;
JSONField
(
self
,
std
::
string
,
device
)
=
"cpu"
;
JSONField
(
self
,
ModelsConfig
,
models
);
JSONField
(
self
,
ModelsConfig
,
models
);
...
...
src/src/config.cpp
View file @
c866715
...
@@ -39,6 +39,10 @@ Config *parse_config( const std::string &name )
...
@@ -39,6 +39,10 @@ Config *parse_config( const std::string &name )
return
NULL
;
return
NULL
;
}
}
if
(
config
->
frame_fps
<
1
)
{
config
->
frame_fps
=
1
;
}
return
config
;
return
config
;
}
}
...
...
src/src/do_request.cpp
View file @
c866715
...
@@ -89,7 +89,7 @@ const int VIDEO_WIDTH = 800;
...
@@ -89,7 +89,7 @@ const int VIDEO_WIDTH = 800;
const
int
VIDEO_HEIGHT
=
600
;
const
int
VIDEO_HEIGHT
=
600
;
seeta
::
FaceTracker
*
g_track
=
NULL
;
//create_face_detector();
//
seeta::FaceTracker *g_track = NULL;//create_face_detector();
seeta
::
FaceDetector
*
g_fd
=
NULL
;
//create_face_detector();
seeta
::
FaceDetector
*
g_fd
=
NULL
;
//create_face_detector();
seeta
::
FaceLandmarker
*
g_pd5
=
NULL
;
//create_face_landmarker();
seeta
::
FaceLandmarker
*
g_pd5
=
NULL
;
//create_face_landmarker();
seeta
::
FaceLandmarker
*
g_pd81
=
NULL
;
//create_face_landmarker();
seeta
::
FaceLandmarker
*
g_pd81
=
NULL
;
//create_face_landmarker();
...
@@ -101,7 +101,7 @@ seeta::EyeStateDetector *g_eye = NULL;
...
@@ -101,7 +101,7 @@ seeta::EyeStateDetector *g_eye = NULL;
/////////////////////////////////
/////////////////////////////////
std
::
mutex
g_fd_lock
;
std
::
mutex
g_fd_lock
;
std
::
mutex
g_track_lock
;
//
std::mutex g_track_lock;
std
::
mutex
g_pd5_lock
;
std
::
mutex
g_pd5_lock
;
std
::
mutex
g_pd81_lock
;
std
::
mutex
g_pd81_lock
;
std
::
mutex
g_fr_lock
;
std
::
mutex
g_fr_lock
;
...
@@ -303,11 +303,13 @@ int init_engine()
...
@@ -303,11 +303,13 @@ int init_engine()
return
-
1
;
return
-
1
;
}
}
/*
g_track = create_face_tracker(VIDEO_WIDTH,VIDEO_HEIGHT);
g_track = create_face_tracker(VIDEO_WIDTH,VIDEO_HEIGHT);
if (!g_track )
if (!g_track )
{
{
return -1;
return -1;
}
}
*/
g_pd5
=
create_face_landmarker5
();
g_pd5
=
create_face_landmarker5
();
if
(
!
g_pd5
)
if
(
!
g_pd5
)
{
{
...
@@ -369,6 +371,7 @@ static SeetaFaceInfoArray face_detector(const SeetaImageData &image)
...
@@ -369,6 +371,7 @@ static SeetaFaceInfoArray face_detector(const SeetaImageData &image)
return
faces
;
return
faces
;
}
}
/*
static SeetaTrackingFaceInfoArray face_tracker(const SeetaImageData &image)
static SeetaTrackingFaceInfoArray face_tracker(const SeetaImageData &image)
{
{
SeetaTrackingFaceInfoArray faces;
SeetaTrackingFaceInfoArray faces;
...
@@ -382,6 +385,7 @@ static SeetaTrackingFaceInfoArray face_tracker(const SeetaImageData &image)
...
@@ -382,6 +385,7 @@ static SeetaTrackingFaceInfoArray face_tracker(const SeetaImageData &image)
}
}
return faces;
return faces;
}
}
*/
static
void
face_landmarker5
(
const
SeetaImageData
&
image
,
const
SeetaRect
&
face
,
SeetaPointF
*
points
)
static
void
face_landmarker5
(
const
SeetaImageData
&
image
,
const
SeetaRect
&
face
,
SeetaPointF
*
points
)
{
{
...
@@ -881,10 +885,12 @@ static std::string do_query_face_video( const std::string &body )
...
@@ -881,10 +885,12 @@ static std::string do_query_face_video( const std::string &body )
//cv::Mat mat = cv::imdecode( imagedatas, 1 ); //COLOR_LOAD_IMAGE_COLOR);
//cv::Mat mat = cv::imdecode( imagedatas, 1 ); //COLOR_LOAD_IMAGE_COLOR);
cv
::
VideoCapture
*
m_capture
=
new
cv
::
VideoCapture
;
cv
::
VideoCapture
*
m_capture
=
new
cv
::
VideoCapture
;
m_capture
->
open
(
filename
.
c_str
());
m_capture
->
open
(
filename
.
c_str
());
//m_capture->set( cv::CAP_PROP_FRAME_WIDTH, VIDEO_WIDTH );
//m_capture->set( cv::CAP_PROP_FRAME_WIDTH, VIDEO_WIDTH );
//m_capture->set( cv::CAP_PROP_FRAME_HEIGHT, VIDEO_HEIGHT );
//m_capture->set( cv::CAP_PROP_FRAME_HEIGHT, VIDEO_HEIGHT );
m_capture
->
set
(
cv
::
CAP_PROP_FPS
,
25
);
if
(
!
m_capture
->
isOpened
())
if
(
!
m_capture
->
isOpened
())
{
{
m_capture
->
release
();
m_capture
->
release
();
...
@@ -899,13 +905,26 @@ static std::string do_query_face_video( const std::string &body )
...
@@ -899,13 +905,26 @@ static std::string do_query_face_video( const std::string &body )
m_heartrate
->
set_frame_number
(
300
);
m_heartrate
->
set_frame_number
(
300
);
m_heartrate
->
reset
();
m_heartrate
->
reset
();
std
::
chrono
::
system_clock
::
time_point
starttimer
=
std
::
chrono
::
system_clock
::
now
();
std
::
chrono
::
system_clock
::
time_point
lasttimer
;
std
::
chrono
::
system_clock
::
time_point
lasttimer
;
std
::
vector
<
double
>
rates
;
std
::
vector
<
double
>
rates
;
cv
::
Mat
mat
;
cv
::
Mat
mat
;
int
nheartrate
=
0
;
int
nheartrate
=
0
;
int
num
=
0
;
int
num
=
0
;
int
per_frame
=
1000
/
g_config
->
frame_fps
;
while
(
1
)
while
(
1
)
{
{
std
::
chrono
::
system_clock
::
time_point
cur
=
std
::
chrono
::
system_clock
::
now
();
auto
timer_duration2
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
cur
-
starttimer
);
if
(
timer_duration2
.
count
()
<
per_frame
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
per_frame
-
timer_duration2
.
count
()));
}
starttimer
=
std
::
chrono
::
system_clock
::
now
();
//std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
if
(
!
m_capture
->
read
(
mat
))
if
(
!
m_capture
->
read
(
mat
))
{
{
std
::
cout
<<
"read end"
<<
std
::
endl
;
std
::
cout
<<
"read end"
<<
std
::
endl
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment