繁体   English   中英

如何在 mediapipe c++ 中获取虹膜检测的地标?

[英]How to get landmarks of iris detection in mediapipe c++?

我正在尝试将面部+眼睛的地标写入终端

我在 demo_run_graph_main 中添加了几行:

#include "mediapipe/calculators/util/landmarks_to_render_data_calculator.pb.h"
#include "mediapipe/framework/formats/landmark.pb.h"
constexpr char kDetectionsStream[] = "face_landmarks_with_iris";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller_detection,
graph.AddOutputStreamPoller(kDetectionsStream));
mediapipe::Packet detection_packet;
if (!poller_detection.Next(&detection_packet)) break;
auto& output_landmarks = detection_packet.Get<std::vector<::mediapipe::NormalizedLandmarkList>>();
for (const ::mediapipe::NormalizedLandmarkList& normalizedlandmarkList : output_landmarks) {
LOG(INFO) << normalizedlandmarkList.DebugString();
}

我正在使用最新 Mediapipe 版本的 MacOs M1 上运行

我希望该程序向我展示面部和虹膜的地标 + 在我的脸上显示带有这些地标的结果直播

它将所有内容写入INFO: Created TensorFlow Lite XNNPACK delegate for CPU.

然后它就停止了。 一点点调试告诉我,处理它需要很长时间

if (!poller_detection.Next(&detection_packet)) break;

那么,我哪里错了?

查看我的完整代码: https ://pastebin.com/H8JV6hsM

我发现如果 poller.QueenSize() 返回 0 会阻塞程序。

尝试这个:

...
mediapipe::Packet detection_packet;
// add this 
if(poller_detection.QueueSize()<=0) continue;
if (!poller_detection.Next(&detection_packet)) break;
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM