Minor updates

This commit is contained in:
udamaster 2022-10-24 00:14:24 -04:00
parent 008f1a0bfa
commit 29cd13f017

View File

@ -24,9 +24,11 @@ public class Lindera {
private ComputerVisionPlugin plugin; private ComputerVisionPlugin plugin;
public FpsHelper fpsHelper = new FpsHelper(); public FpsHelper fpsHelper = new FpsHelper();
private PoseTracking poseTracking; private PoseTracking poseTracking;
// TODO: Verify that this is the timestamp used in Actual Plugin // TODO: Verify that this is the timestamp used in Actual Plugin
private int timeStamp = 0; private int timeStamp = 0;
private CameraRotation cameraRotation = CameraRotation.AUTOMATIC; private CameraRotation cameraRotation = CameraRotation.AUTOMATIC;
// Live camera demo UI and camera components. // Live camera demo UI and camera components.
private CameraInput cameraInput; private CameraInput cameraInput;
private SolutionGlSurfaceView<PoseTrackingResult> glSurfaceView; private SolutionGlSurfaceView<PoseTrackingResult> glSurfaceView;
@ -76,7 +78,7 @@ public class Lindera {
this.cameraRotation = cameraRotation; this.cameraRotation = cameraRotation;
} }
public void setupEventListener() { private void setupEventListener() {
poseTracking.setResultListener( poseTracking.setResultListener(
poseTrackingResult -> { poseTrackingResult -> {
fpsHelper.logNewPoint(); fpsHelper.logNewPoint();
@ -130,7 +132,6 @@ public class Lindera {
); );
} }
public void startDetection(PoseTrackingOptions options){ public void startDetection(PoseTrackingOptions options){
// ensure that class is initalized // ensure that class is initalized
assert (appCompatActivity != null); assert (appCompatActivity != null);
@ -147,12 +148,16 @@ public class Lindera {
// Initializes a new Gl surface view with a user-defined PoseTrackingResultGlRenderer. // Initializes a new Gl surface view with a user-defined PoseTrackingResultGlRenderer.
glSurfaceView = glSurfaceView =
new SolutionGlSurfaceView<>( new SolutionGlSurfaceView<>(
appCompatActivity, poseTracking.getGlContext(), poseTracking.getGlMajorVersion()); appCompatActivity,
poseTracking.getGlContext(),
poseTracking.getGlMajorVersion()
);
glSurfaceView.setSolutionResultRenderer(new PoseTrackingResultGlRenderer()); glSurfaceView.setSolutionResultRenderer(new PoseTrackingResultGlRenderer());
glSurfaceView.setRenderInputImage(true); glSurfaceView.setRenderInputImage(true);
setupEventListener(); setupEventListener();
// The runnable to start camera after the gl surface view is attached. // The runnable to start camera after the gl surface view is attached.
// For video input source, videoInput.start() will be called when the video uri is available. // For video input source, videoInput.start() will be called when the video uri is available.
glSurfaceView.post(this::startCamera); glSurfaceView.post(this::startCamera);