From 6825cf07a31845dc6b3d2c7dcc8e1377b75517ca Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期一, 17 七月 2017 15:20:38 +0800
Subject: [PATCH]
---
VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp
index 194a8b0..6147424 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapper.cpp
@@ -56,6 +56,7 @@
RectWrapper rw;
rw.rect = iter->rect;
rw.user_score_1 = ((90.0f - std::abs(iter->yaw)) + (90.0f - std::abs(iter->pitch)) + (90.0f - std::abs(iter->roll))) / 90.0f / 3 * iter->score;
+ rw.userData = (void*)(iter->id);
rects.push_back(rw);
}
}
@@ -193,7 +194,8 @@
bool cw_pm_breaker_ptr_paint(const PipeMaterial* pm, void* args)
{
- PLPLContext& plplContext(*(PLPLContext*)args);
+ CameraWrapper& cameraWrapper = *(CameraWrapper*)args;
+ PLPLContext& plplContext(cameraWrapper.plplContext);
const st_ff_vect_t& faceFeatures(*(const st_ff_vect_t*)(pm->buffer));
plplContext.cmds.clear();
@@ -234,10 +236,15 @@
plplContext.params.push_back(iter->rect.rightBottom.X);
plplContext.params.push_back(iter->rect.rightBottom.Y);
- plplContext.cmds.push_back(PLPLC_TEXT);
- plplContext.params.push_back(iter->rect.leftTop.X);
- plplContext.params.push_back(iter->rect.leftTop.Y);
- plplContext.params.push_back(PLPLType("abc"));
+ std::map<int, std::string>::iterator iterFaceLabel = cameraWrapper.faceLabels.find(iter->id);
+ if (iterFaceLabel != cameraWrapper.faceLabels.end())
+ {
+ plplContext.cmds.push_back(PLPLC_TEXT);
+ plplContext.params.push_back(iter->rect.leftTop.X);
+ plplContext.params.push_back(iter->rect.leftTop.Y);
+ const char* label = iterFaceLabel->second.c_str();
+ plplContext.params.push_back(PLPLType(label));
+ }
}
return false;
@@ -262,6 +269,10 @@
void test_paint(CameraWrapper& cameraWrapper)
{
+ cameraWrapper.setFaceLabel(0, "vip");
+ cameraWrapper.setFaceLabel(1, "abc");
+ cameraWrapper.setFaceLabel(2, "wrn");
+
cameraWrapper.plplContext.cmds.push_back(PLPLC_COLOR);
cameraWrapper.plplContext.params.push_back('F');
cameraWrapper.plplContext.params.push_back(255);
@@ -304,7 +315,7 @@
pmAnalizer.breake(PipeMaterial::PMT_PTR, MB_Frame::MBFT__FIRST, cw_pm_breaker_ptr_face, &(cameraWrapper));
}
- pm.breake(PipeMaterial::PMT_PTR, MB_Frame::MBFT__FIRST, cw_pm_breaker_ptr_paint, &(cameraWrapper.plplContext));
+ pm.breake(PipeMaterial::PMT_PTR, MB_Frame::MBFT__FIRST, cw_pm_breaker_ptr_paint, &(cameraWrapper));
//#debug
//test_paint(cameraWrapper);
@@ -324,3 +335,11 @@
{
faceCacheLocked = false;
}
+
+void CameraWrapper::setFaceLabel(int st_track_id, const std::string& label)
+{
+ if (faceLabels.size() > 32)
+ faceLabels.clear();
+
+ faceLabels.insert(std::make_pair(st_track_id, label));
+}
--
Gitblit v1.8.0