Add the possibility to get landmark visibility

This commit is contained in:
Maksym Walczak 2022-08-09 14:27:36 +02:00
parent 2a85afc405
commit cdd3835d13
3 changed files with 24 additions and 1 deletions

View File

@ -77,6 +77,21 @@ bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH
The results will be stored in the `bazel-bin\mediapipe\pose_tracking_dll` folder. The results will be stored in the `bazel-bin\mediapipe\pose_tracking_dll` folder.
In the case the build stalls, pressing Ctrl+C might not be sufficient to stop the task. In that case, if you try to (resume the) build again,
the following message will be displayed:
```
Another command (pid=5300) is running. Waiting for it to complete on the server (server_pid=3684)
```
Unfortunately this process is hidden for some reason and can't be found in taskmgr. Fortunately, you can use the `taskkill` command to kill the process:
```
taskkill /F /PID 3684
```
After that, you should be able to run the build command again.
### Build debug symbols ### Build debug symbols
- `dbg` can be used in place of `opt` to build the library with debug symbols in Visual Studio pdb format. - `dbg` can be used in place of `opt` to build the library with debug symbols in Visual Studio pdb format.

View File

@ -116,6 +116,7 @@ class PoseTrackingImpl {
poseLandmarks[j].x = landmark.x(); poseLandmarks[j].x = landmark.x();
poseLandmarks[j].y = landmark.y(); poseLandmarks[j].y = landmark.y();
poseLandmarks[j].z = landmark.z(); poseLandmarks[j].z = landmark.z();
visibility[j] = landmark.visibility();
} }
return absl::OkStatus(); return absl::OkStatus();
@ -124,6 +125,7 @@ class PoseTrackingImpl {
nimagna::cv_wrapper::Point3f* lastDetectedLandmarks() { return poseLandmarks; } nimagna::cv_wrapper::Point3f* lastDetectedLandmarks() { return poseLandmarks; }
cv::Mat lastSegmentedFrame() { return segmentedMask; } cv::Mat lastSegmentedFrame() { return segmentedMask; }
float* landmarksVisibility() { return visibility; }
static constexpr size_t kLandmarksCount = 33u; static constexpr size_t kLandmarksCount = 33u;
@ -131,12 +133,13 @@ class PoseTrackingImpl {
mediapipe::Packet poseLandmarksPacket; mediapipe::Packet poseLandmarksPacket;
cv::Mat segmentedMask; cv::Mat segmentedMask;
nimagna::cv_wrapper::Point3f poseLandmarks[kLandmarksCount]; nimagna::cv_wrapper::Point3f poseLandmarks[kLandmarksCount];
float visibility[kLandmarksCount] = {0};
std::unique_ptr<mediapipe::OutputStreamPoller> maskPollerPtr; std::unique_ptr<mediapipe::OutputStreamPoller> maskPollerPtr;
std::unique_ptr<mediapipe::OutputStreamPoller> landmarksPollerPtr; std::unique_ptr<mediapipe::OutputStreamPoller> landmarksPollerPtr;
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
const char* kInputStream = "input_video"; const char* kInputStream = "input_video";
const char* kOutputSegmentationStream = "segmentation_mask"; const char* kOutputSegmentationStream = "segmentation_mask";
const char* kOutpuLandmarksStream = "pose_landmarks"; const char* kOutpuLandmarksStream = "pose_world_landmarks";
}; };
namespace nimagna { namespace nimagna {
@ -153,6 +156,10 @@ cv_wrapper::Point3f* PoseTracking::lastDetectedLandmarks() {
return mImplementation->lastDetectedLandmarks(); return mImplementation->lastDetectedLandmarks();
} }
float* PoseTracking::lastLandmarksVisibility() {
return mImplementation->landmarksVisibility();
}
cv_wrapper::Mat PoseTracking::lastSegmentedFrame() { cv_wrapper::Mat PoseTracking::lastSegmentedFrame() {
const cv::Mat result = mImplementation->lastSegmentedFrame(); const cv::Mat result = mImplementation->lastSegmentedFrame();

View File

@ -108,6 +108,7 @@ class DLLEXPORT PoseTracking {
bool processFrame(const cv_wrapper::Mat& inputRGB8Bit); bool processFrame(const cv_wrapper::Mat& inputRGB8Bit);
cv_wrapper::Mat lastSegmentedFrame(); cv_wrapper::Mat lastSegmentedFrame();
cv_wrapper::Point3f* lastDetectedLandmarks(); cv_wrapper::Point3f* lastDetectedLandmarks();
float* lastLandmarksVisibility();
private: private:
PoseTrackingImpl* mImplementation; PoseTrackingImpl* mImplementation;