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 8c6f7daa
authored
Aug 22, 2022
by
wangquyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add by wqy
1 parent
641cf4ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
15 deletions
src/include/do_request.h
src/src/do_request.cpp
src/include/do_request.h
View file @
8c6f7da
...
...
@@ -27,6 +27,8 @@ struct bone_config : public websocketpp::config::asio
static
bool
const
enable_multithreading
=
true
;
static
size_t
const
max_message_size
=
2048
*
1000
*
1000
;
static
long
const
timeout_open_handshake
=
60
*
1000
;
struct
transport_config
:
public
core
::
transport_config
{
typedef
core
::
concurrency_type
concurrency_type
;
...
...
src/src/do_request.cpp
View file @
8c6f7da
...
...
@@ -509,7 +509,7 @@ static std::vector<float> face_action( const SeetaImageData &image, const SeetaP
try
{
features
.
resize
(
g_action
->
GetExtractFeatureSize
()
);
std
::
cout
<<
"face_action: GetExtractFeatureSize():"
<<
g_action
->
GetExtractFeatureSize
()
<<
std
::
endl
;
//
std::cout << "face_action: GetExtractFeatureSize():" << g_action->GetExtractFeatureSize() << std::endl;
g_action
->
Extract
(
image
,
points
,
features
.
data
()
);
}
catch
(
std
::
exception
&
e
)
...
...
@@ -526,7 +526,7 @@ static std::vector<float> face_emotion( const SeetaImageData &image, const Seeta
try
{
features
.
resize
(
g_emotion
->
emotion_count
()
);
std
::
cout
<<
"face_emotion: emotion_count():"
<<
g_emotion
->
emotion_count
()
<<
std
::
endl
;
//
std::cout << "face_emotion: emotion_count():" << g_emotion->emotion_count() << std::endl;
g_emotion
->
recognize_emotion
(
image
,
points
,
features
.
data
()
);
}
catch
(
std
::
exception
&
e
)
...
...
@@ -992,12 +992,12 @@ static void do_heart_rate( const std::string &videofile, int *rate )
}
}
std
::
cout
<<
"-----num:"
<<
num
<<
std
::
endl
;
//
std::cout << "-----num:" << num << std::endl;
double
value
=
0.0
;
int
nret
=
recognize
(
m_heartrate
,
mat
,
img
,
faces
.
data
[
index
].
pos
,
value
);
if
(
nret
==
0
)
{
std
::
cout
<<
"-----rate:"
<<
value
<<
std
::
endl
;
//
std::cout << "-----rate:" << value << std::endl;
rates
.
push_back
(
value
);
if
(
rates
.
size
()
<=
1
)
{
...
...
@@ -1162,7 +1162,7 @@ static void do_video( const std::string &videofile, int frameNum, int *eyes,
}
}
std
::
cout
<<
"-----num:"
<<
num
<<
std
::
endl
;
//
std::cout << "-----num:" << num << std::endl;
SeetaPointF
points
[
5
];
...
...
@@ -1194,27 +1194,41 @@ static void do_video( const std::string &videofile, int frameNum, int *eyes,
poses
.
push_back
(
yaw
);
poses
.
push_back
(
pitch
);
poses
.
push_back
(
roll
);
//std::cout << "yaw:" << yaw << ",pitch:" << pitch << ",roll:" << roll << std::endl;
face_poses
.
push_back
(
poses
);
seeta
::
EyeStateDetector
::
EYE_STATE
leftstate
,
rightstate
;
leftstate
=
rightstate
=
seeta
::
EyeStateDetector
::
EYE_UNKNOWN
;
eye_detect
(
img
,
points
,
leftstate
,
rightstate
);
int
count
=
geteyecount
(
m_leftstate
,
leftstate
);
/*
if(count >= 0)
{
*
eyes
+=
count
;
//
*eyes += count;
m_leftstate = leftstate;
}
count
=
geteyecount
(
m_rightstate
,
rightstate
);
if
(
count
>=
0
)
*/
m_leftstate
=
leftstate
;
int
count2
=
geteyecount
(
m_rightstate
,
rightstate
);
/*
if(count2 >= 0)
{
*
eyes
+=
count
;
//
*eyes += count;
m_rightstate = rightstate;
}
*/
m_rightstate
=
rightstate
;
if
((
count
>
0
)
&&
(
count2
>
0
))
{
*
eyes
=
(
*
eyes
)
+
1
;
std
::
cout
<<
"eyes:"
<<
*
eyes
<<
std
::
endl
;
}
if
((
leftstate
==
seeta
::
EyeStateDetector
::
EYE_OPEN
)
||
(
rightstate
==
seeta
::
EyeStateDetector
::
EYE_OPEN
))
{
...
...
@@ -1516,9 +1530,10 @@ void on_http( httpserver *s, websocketpp::connection_hdl hdl )
remove
(
filename
.
c_str
()
);
strresponse
=
"{
\"
code
\"
:"
+
std
::
to_string
(
nret
)
+
",
\"
msg
\"
:
\"
"
+
GetError
(
nret
)
+
"
\"
,
\"
data
\"
:{"
;
strresponse
+=
"
\"
resultData
\"
:{
\"
blinkNum
\"
:"
+
std
::
to_string
(
eyes
)
+
",
\"
heartRate
\"
:"
+
std
::
to_string
(
hearts
)
+
"}"
;
strresponse
+=
",
\"
user
f
aces
\"
:["
;
strresponse
+=
",
\"
user
F
aces
\"
:["
;
for
(
int
i
=
0
;
i
<
face_features
.
size
();
i
++
)
//for(int i=0; i<2; i++)
{
std
::
string
strtmp
(
(
const
char
*
)
face_features
[
i
].
data
(),
int
(
face_features
[
i
].
size
()
*
sizeof
(
float
)
)
);
std
::
string
enbase64
=
base64_encode
(
strtmp
);
...
...
@@ -1542,7 +1557,7 @@ void on_http( httpserver *s, websocketpp::connection_hdl hdl )
num
=
blink_eyes
.
size
();
std
::
cout
<<
"num:"
<<
num
<<
std
::
endl
;
//num =
10
;
//num =
3
;
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
if
(
i
>
0
)
...
...
@@ -1596,7 +1611,8 @@ void on_http( httpserver *s, websocketpp::connection_hdl hdl )
g_response
=
strresponse
;
std
::
cout
<<
"response:"
<<
strresponse
.
length
()
<<
std
::
endl
;
create_http_response
(
con
,
strresponse
,
200
);
/*
int fd = open( "/tmp/response.txt", O_WRONLY | O_CREAT | O_TRUNC, 0666 );
if( fd >= 0 )
{
...
...
@@ -1604,6 +1620,7 @@ void on_http( httpserver *s, websocketpp::connection_hdl hdl )
close( fd );
}
sleep(1);
*/
return
;
}
...
...
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