Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FaceDetection
Overview
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
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanghui.cui
FaceDetection
Commits
e3017f8f
Commit
e3017f8f
authored
Feb 23, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询用户为空处理
parent
13f5f3ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
29 deletions
+27
-29
FaceDetection/CommonStruct.h
+6
-5
FaceDetection/FaceDetection.cpp
+21
-24
No files found.
FaceDetection/CommonStruct.h
View file @
e3017f8f
...
...
@@ -3,11 +3,12 @@
#include <dlib/opencv.h>
struct
TargetInfo
{
std
::
string
strName
;
//目标名称
std
::
string
strPhone
;
//手机号
dlib
::
rectangle
rc
;
//头像位置
int
iCode
=
0
;
//用户编码
bool
bSuccess
=
false
;
//是否成功获取到用户信息
std
::
string
strName
;
//目标名称
std
::
string
strPhone
;
//手机号
std
::
string
strConfidence
;
//相似度
dlib
::
rectangle
rc
;
//头像位置
int
iCode
=
0
;
//用户编码
bool
bSuccess
=
false
;
//是否成功获取到用户信息
};
struct
sReqCertificate
...
...
FaceDetection/FaceDetection.cpp
View file @
e3017f8f
...
...
@@ -169,10 +169,16 @@ void reqUserInfoByImg(int index, string &imgPath)
float
fNum
=
0.00
;
fNum
=
atof
(
response
.
vecUser
[
0
].
confidence
.
data
());
if
(
fNum
>
80.000
)
{
target
.
strName
=
response
.
vecUser
[
0
].
memberName
;
target
.
strPhone
=
response
.
vecUser
[
0
].
memberTel
;
target
.
strName
=
"姓名:"
+
response
.
vecUser
[
0
].
memberName
;
target
.
strPhone
=
"电话:"
+
response
.
vecUser
[
0
].
memberTel
;
target
.
strConfidence
=
"相似度:"
+
response
.
vecUser
[
0
].
confidence
;
}
}
else
{
//没有用户信息,清空
target
.
strName
=
""
;
target
.
strPhone
=
""
;
target
.
strConfidence
=
""
;
}
target
.
bSuccess
=
rlt
;
break
;
...
...
@@ -258,9 +264,15 @@ int main()
vecTracker
[
i
].
start_track
(
cimg
,
dlib
::
centered_rect
((
dets
[
i
].
right
()
+
dets
[
i
].
left
())
/
2
,
(
dets
[
i
].
top
()
+
dets
[
i
].
bottom
())
/
2
,
dets
[
i
].
width
(),
dets
[
i
].
height
()));
}
for
(
int
i
=
0
;
i
<
max_target
;
i
++
)
{
temp_dets
[
i
]
=
track_dets
[
i
];
for
(
int
i
=
0
;
i
<
max_target
;
i
++
)
{
temp_dets
[
i
]
=
track_dets
[
i
];
//缓存历史数据
//清空目标容器数据
track_dets
[
i
].
rc
=
{
0
,
0
,
0
,
0
};
track_dets
[
i
].
strConfidence
=
""
;
track_dets
[
i
].
bSuccess
=
false
;
track_dets
[
i
].
strName
=
""
;
track_dets
[
i
].
strPhone
=
""
;
track_dets
[
i
].
iCode
=
0
;
}
bTargetUpdate
=
true
;
}
...
...
@@ -290,25 +302,9 @@ int main()
_save_target_img
(
temp
,
new_position
,
strPathImg
.
data
());
//查询提交到线程池
pool
.
commit
(
reqUserInfoByImg
,
iReqServerCount
,
strPathImg
);
//std::string postResponseStr;
//auto res = curl_post_req(strUrl, strPathImg, postResponseStr);
//if (res != CURLE_OK)
// LOG(INFO) << "curl_easy_perform() failed: " + string(curl_easy_strerror(res));
//else {
// postResponseStr = UnicodeToAscii(Utf8ToUnicode(postResponseStr));
// LOG(INFO) << "utf8 to ascii:" << postResponseStr;
//}
//sServerResponse response = GetServerResultData(postResponseStr.data());
//if (response.vecUser.size() > 0) {
// track_dets[i].strName = response.vecUser[0].memberName;
// track_dets[i].strPhone = response.vecUser[0].memberTel;
//}
//
//cout << "cols:" << temp.cols << " rows:" << temp.rows << endl;
//cout << "new_position.height():" << new_position.height() << " new_position.width():" << new_position.width() << endl;
cout
<<
"iReqServerCount:"
<<
iReqServerCount
<<
endl
;
iReqServerCount
++
;
}
...
...
@@ -346,8 +342,9 @@ int main()
cv
::
putText
(
temp
,
active_models_st
,
cv
::
Point
(
10
,
60
),
CV_FONT_HERSHEY_SIMPLEX
,
0.5
,
CV_RGB
(
255
,
0
,
0
),
1
,
CV_AA
);
for
(
int
i
=
0
;
i
<
target
;
i
++
)
{
text
.
putText
(
&
IplImage
(
temp
),
track_dets
[
i
].
strName
.
data
(),
cvPoint
(
track_dets
[
i
].
rc
.
right
()
+
5
,
track_dets
[
i
].
rc
.
top
()
+
20
),
CV_RGB
(
255
,
0
,
0
));
text
.
putText
(
&
IplImage
(
temp
),
track_dets
[
i
].
strPhone
.
data
(),
cvPoint
(
track_dets
[
i
].
rc
.
right
()
+
5
,
track_dets
[
i
].
rc
.
top
()
+
60
),
CV_RGB
(
255
,
0
,
0
));
text
.
putText
(
&
IplImage
(
temp
),
track_dets
[
i
].
strName
.
data
(),
cvPoint
(
track_dets
[
i
].
rc
.
right
()
+
5
,
track_dets
[
i
].
rc
.
top
()
+
15
),
CV_RGB
(
255
,
0
,
0
));
text
.
putText
(
&
IplImage
(
temp
),
track_dets
[
i
].
strPhone
.
data
(),
cvPoint
(
track_dets
[
i
].
rc
.
right
()
+
5
,
track_dets
[
i
].
rc
.
top
()
+
50
),
CV_RGB
(
255
,
0
,
0
));
text
.
putText
(
&
IplImage
(
temp
),
track_dets
[
i
].
strConfidence
.
data
(),
cvPoint
(
track_dets
[
i
].
rc
.
right
()
+
5
,
track_dets
[
i
].
rc
.
top
()
+
85
),
CV_RGB
(
255
,
0
,
0
));
}
// Display it all on the screen
//win.set_size(800, 600);
...
...
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