changed timestamp to nanoseconds, added presence
This commit is contained in:
parent
0d907a79d1
commit
fa5da361d7
|
@ -1,5 +1,5 @@
|
|||
package com.google.mediapipe.solutions.lindera;
|
||||
|
||||
public interface ComputerVisionPlugin {
|
||||
void bodyJoints(int timestamp, BodyJoints bodyJoints);
|
||||
void bodyJoints(long timestamp, BodyJoints bodyJoints);
|
||||
}
|
||||
|
|
|
@ -25,8 +25,10 @@ public class Lindera {
|
|||
public FpsHelper fpsHelper = new FpsHelper();
|
||||
private PoseTracking poseTracking;
|
||||
|
||||
// TODO: Verify that this is the timestamp used in Actual Plugin
|
||||
private int timeStamp = 0;
|
||||
|
||||
private long getTimeStamp(){
|
||||
return System.nanoTime();
|
||||
}
|
||||
private CameraRotation cameraRotation = CameraRotation.AUTOMATIC;
|
||||
|
||||
// Live camera demo UI and camera components.
|
||||
|
@ -85,14 +87,13 @@ public class Lindera {
|
|||
glSurfaceView.setRenderData(poseTrackingResult);
|
||||
glSurfaceView.requestRender();
|
||||
ImmutableList<LandmarkProto.Landmark> landmarks = poseTrackingResult.multiPoseLandmarks();
|
||||
timeStamp+=1;
|
||||
|
||||
if (landmarks.isEmpty()) return;
|
||||
|
||||
BodyJoints bodyJoints = new BodyJoints();
|
||||
landmarksToBodyJoints(landmarks,bodyJoints);
|
||||
|
||||
plugin.bodyJoints(timeStamp, bodyJoints);
|
||||
plugin.bodyJoints(getTimeStamp(), bodyJoints);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -180,7 +181,6 @@ public class Lindera {
|
|||
if (poseTracking != null) {
|
||||
poseTracking.close();
|
||||
}
|
||||
timeStamp = 0;
|
||||
}
|
||||
|
||||
private void landmarkToXYZPointWithConfidence(LandmarkProto.Landmark landmark,XYZPointWithConfidence bodyJoint){
|
||||
|
@ -188,6 +188,8 @@ public class Lindera {
|
|||
bodyJoint.y = landmark.getY();
|
||||
bodyJoint.z = landmark.getZ();
|
||||
bodyJoint.confidence = landmark.getVisibility();
|
||||
bodyJoint.presence = landmark.getPresence();
|
||||
|
||||
}
|
||||
|
||||
private void landmarksToBodyJoints(ImmutableList<LandmarkProto.Landmark> landmarks , BodyJoints bodyJoints){
|
||||
|
|
|
@ -5,6 +5,7 @@ public class XYZPointWithConfidence {
|
|||
public float y = 0;
|
||||
public float z = 0;
|
||||
public float confidence = 0;
|
||||
public float presence = 0;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user