1 package com.introlab.rtabmap;
3 import java.nio.ByteBuffer;
4 import java.nio.FloatBuffer;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import java.util.EnumSet;
9 import java.util.concurrent.atomic.AtomicBoolean;
11 import com.google.ar.core.Anchor;
12 import com.google.ar.core.Camera;
13 import com.google.ar.core.CameraConfig;
14 import com.google.ar.core.CameraConfigFilter;
15 import com.google.ar.core.CameraIntrinsics;
16 import com.google.ar.core.Config;
17 import com.google.ar.core.Coordinates2d;
18 import com.google.ar.core.Frame;
19 import com.google.ar.core.PointCloud;
20 import com.google.ar.core.Pose;
21 import com.google.ar.core.Session;
22 import com.google.ar.core.SharedCamera;
23 import com.google.ar.core.TrackingState;
24 import com.google.ar.core.exceptions.CameraNotAvailableException;
25 import com.google.ar.core.exceptions.NotYetAvailableException;
26 import com.google.ar.core.exceptions.UnavailableException;
28 import android.content.Context;
29 import android.graphics.ImageFormat;
30 import android.hardware.camera2.CameraAccessException;
31 import android.hardware.camera2.CameraCaptureSession;
32 import android.hardware.camera2.CameraCharacteristics;
33 import android.hardware.camera2.CameraDevice;
34 import android.hardware.camera2.CameraManager;
35 import android.hardware.camera2.CameraMetadata;
36 import android.hardware.camera2.CaptureFailure;
37 import android.hardware.camera2.CaptureRequest;
38 import android.hardware.camera2.TotalCaptureResult;
39 import android.media.Image;
40 import android.opengl.GLES20;
41 import android.opengl.GLSurfaceView;
42 import android.os.Handler;
43 import android.os.HandlerThread;
44 import android.support.annotation.NonNull;
45 import android.util.Log;
46 import android.view.Surface;
47 import android.widget.Toast;
55 -1.0f, -1.0f, +1.0f, -1.0f, -1.0f, +1.0f, +1.0f, +1.0f,
108 private AtomicBoolean
mReady =
new AtomicBoolean(
false);
128 new CameraDevice.StateCallback() {
130 public void onOpened(@NonNull CameraDevice cameraDevice) {
131 Log.d(TAG,
"Camera device ID " + cameraDevice.getId() +
" opened.");
137 public void onClosed(@NonNull CameraDevice cameraDevice) {
138 Log.d(TAG,
"Camera device ID " + cameraDevice.getId() +
" closed.");
143 public void onDisconnected(@NonNull CameraDevice cameraDevice) {
144 Log.w(TAG,
"Camera device ID " + cameraDevice.getId() +
" disconnected.");
145 cameraDevice.close();
150 public void onError(@NonNull CameraDevice cameraDevice,
int error) {
151 Log.e(TAG,
"Camera device ID " + cameraDevice.getId() +
" error " + error);
152 cameraDevice.close();
158 CameraCaptureSession.StateCallback cameraCaptureCallback =
159 new CameraCaptureSession.StateCallback() {
164 public void onConfigured(@NonNull CameraCaptureSession session) {
165 Log.d(TAG,
"Camera capture session configured.");
166 captureSession = session;
171 public void onSurfacePrepared(
172 @NonNull CameraCaptureSession session, @NonNull Surface surface) {
173 Log.d(TAG,
"Camera capture surface prepared.");
177 public void onReady(@NonNull CameraCaptureSession session) {
178 Log.d(TAG,
"Camera capture session ready.");
182 public void onActive(@NonNull CameraCaptureSession session) {
183 Log.d(TAG,
"Camera capture session active.");
188 public void onClosed(@NonNull CameraCaptureSession session) {
189 Log.d(TAG,
"Camera capture session closed.");
193 public void onConfigureFailed(@NonNull CameraCaptureSession session) {
194 Log.e(TAG,
"Failed to configure camera capture session.");
200 new CameraCaptureSession.CaptureCallback() {
203 public void onCaptureCompleted(
204 @NonNull CameraCaptureSession session,
205 @NonNull CaptureRequest request,
206 @NonNull TotalCaptureResult result) {
211 public void onCaptureBufferLost(
212 @NonNull CameraCaptureSession session,
213 @NonNull CaptureRequest request,
216 Log.e(TAG,
"onCaptureBufferLost: " + frameNumber);
220 public void onCaptureFailed(
221 @NonNull CameraCaptureSession session,
222 @NonNull CaptureRequest request,
223 @NonNull CaptureFailure failure) {
224 Log.e(TAG,
"onCaptureFailed: " + failure.getFrameNumber() +
" " + failure.getReason());
228 public void onCaptureSequenceAborted(
229 @NonNull CameraCaptureSession session,
int sequenceId) {
230 Log.e(TAG,
"onCaptureSequenceAborted: " + sequenceId +
" " + session);
237 if (sharedSession == null) {
242 Log.i(TAG,
"Resume ARCore.");
244 sharedSession.resume();
247 }
catch (CameraNotAvailableException
e) {
248 Log.e(TAG,
"Failed to resume ARCore session", e);
259 captureSession.setRepeatingRequest(
261 }
catch (CameraAccessException
e) {
262 Log.e(TAG,
"Failed to set repeating request", e);
268 Log.e(TAG,
"createCameraPreviewSession: " +
"starting camera preview session.");
271 sharedSession.setCameraTextureName(cameraTextureId);
277 List<Surface> surfaceList = sharedCamera.getArCoreSurfaces();
278 Log.e(TAG,
" createCameraPreviewSession: " +
"surfaceList: sharedCamera.getArCoreSurfaces(): " + surfaceList.size());
282 if (mTOFAvailable && cameraId.compareTo(depthCameraId) == 0) surfaceList.add(mTOFImageReader.
imageReader.getSurface());
289 for (Surface surface : surfaceList) {
294 CameraCaptureSession.StateCallback wrappedCallback = sharedCamera.createARSessionStateCallback(cameraCaptureCallback, backgroundHandler);
297 cameraDevice.createCaptureSession(surfaceList, wrappedCallback, backgroundHandler);
300 }
catch (CameraAccessException
e) {
301 Log.e(TAG,
"CameraAccessException", e);
307 backgroundThread =
new HandlerThread(
"sharedCameraBackground");
308 backgroundThread.start();
309 backgroundHandler =
new Handler(backgroundThread.getLooper());
315 if (backgroundThread != null) {
316 backgroundThread.quitSafely();
318 backgroundThread.join();
319 backgroundThread = null;
320 backgroundHandler = null;
321 }
catch (InterruptedException
e) {
322 Log.e(TAG,
"Interrupted while trying to join background handler thread", e);
335 private static boolean contains(
int[] modes,
int mode) {
339 for (
int i : modes) {
354 if(cameraTextureId == -1)
356 int[] textures =
new int[1];
357 GLES20.glGenTextures(1, textures, 0);
358 cameraTextureId = textures[0];
361 Log.v(TAG,
"Perform various checks, then open camera device and create CPU image reader.");
363 if (cameraDevice != null) {
367 if (sharedSession == null) {
370 sharedSession =
new Session(mActivity, EnumSet.of(Session.Feature.SHARED_CAMERA));
371 }
catch (UnavailableException
e) {
372 Log.e(TAG,
"Failed to create ARCore session that supports camera sharing", e);
378 CameraConfigFilter cameraConfigFilter =
new CameraConfigFilter(sharedSession);
379 CameraConfig[] cameraConfigs = sharedSession.getSupportedCameraConfigs(cameraConfigFilter).toArray(
new CameraConfig[0]);
380 Log.i(TAG,
"Size of supported CameraConfigs list is " + cameraConfigs.length);
383 int highestResolutionIndex=-1;
384 int highestResolution = 0;
385 for(
int i=0; i<cameraConfigs.length; ++i)
387 Log.i(TAG,
"Camera ID: " + cameraConfigs[i].getCameraId());
388 Log.i(TAG,
"Resolution: " + cameraConfigs[i].getImageSize().getWidth() +
"x" + cameraConfigs[i].getImageSize().getHeight());
389 if(highestResolution == 0 || highestResolution < cameraConfigs[i].getImageSize().getWidth())
391 highestResolutionIndex = i;
392 highestResolution = cameraConfigs[i].getImageSize().getWidth();
395 if(highestResolutionIndex>=0)
403 Config
config = sharedSession.getConfig();
404 config.setFocusMode(Config.FocusMode.FIXED);
405 config.setUpdateMode(Config.UpdateMode.BLOCKING);
406 config.setPlaneFindingMode(Config.PlaneFindingMode.DISABLED);
407 config.setLightEstimationMode(Config.LightEstimationMode.DISABLED);
408 config.setCloudAnchorMode(Config.CloudAnchorMode.DISABLED);
409 sharedSession.configure(config);
414 sharedCamera = sharedSession.getSharedCamera();
416 cameraId = sharedSession.getCameraConfig().getCameraId();
418 Log.d(TAG,
"Shared camera ID: " + cameraId);
420 mTOFAvailable =
false;
423 cameraManager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);
425 depthCameraId = null;
429 for (String tmpCameraId : cameraManager.getCameraIdList()) {
430 CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(tmpCameraId);
432 Log.i(TAG,
"Camera " + tmpCameraId +
" extrinsics:");
434 float[]
translation = characteristics.get(CameraCharacteristics.LENS_POSE_TRANSLATION);
435 if(translation != null)
437 Log.i(TAG, String.format(
"Translation (x,y,z): %f,%f,%f", translation[0], translation[1], translation[2]));
439 float[]
rotation = characteristics.get(CameraCharacteristics.LENS_POSE_ROTATION);
442 Log.i(TAG, String.format(
"Rotation (qx,qy,qz,qw): %f,%f,%f,%f", rotation[0], rotation[1], rotation[2], rotation[3]));
445 if(tmpCameraId.compareTo(cameraId)==0 && translation!=null && rotation!=null)
447 rgbExtrinsics =
new Pose(translation, rotation);
448 Log.i(TAG,
"Set rgb extrinsics!");
451 if (!
contains(characteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES), CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) ||
452 characteristics.get(CameraCharacteristics.LENS_FACING) == CameraMetadata.LENS_FACING_FRONT) {
455 Log.i(TAG,
"Camera " + tmpCameraId +
" has depth output available");
457 depthCameraId = tmpCameraId;
458 if(translation!=null && rotation != null)
460 depthExtrinsics =
new Pose(translation, rotation);
461 Log.i(TAG,
"Set depth extrinsics!");
463 depthIntrinsics = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION);
464 Log.i(TAG, String.format(
"Intrinsics (fx,fy,cx,cy,s): %f,%f,%f,%f,%f",
469 depthIntrinsics[4]));
471 }
catch (CameraAccessException
e) {
474 if(rgbExtrinsics == null)
478 rgbExtrinsics =
new Pose(translation, rotation);
480 if(depthExtrinsics == null)
485 if(depthCameraId != null)
487 ArrayList<String> resolutions =
getResolutions(mActivity, depthCameraId, ImageFormat.DEPTH16);
488 if (resolutions != null) {
489 float[] newDepthIntrinsics = null;
490 int largestWidth = 0;
491 for( String temp : resolutions) {
492 Log.i(TAG,
"DEPTH16 resolution: " + temp);
493 depthWidth = Integer.parseInt(temp.split(
"x")[0]);
494 depthHeight = Integer.parseInt(temp.split(
"x")[1]);
495 if(depthIntrinsics != null)
497 if(depthIntrinsics[0] != 0)
499 if(largestWidth == 0 && depthWidth>largestWidth)
504 if(depthWidth < largestWidth)
506 float scale = (float)depthWidth/(
float)largestWidth;
507 newDepthIntrinsics = depthIntrinsics.clone();
508 newDepthIntrinsics[0] *=
scale;
509 newDepthIntrinsics[1] *=
scale;
510 newDepthIntrinsics[2] *=
scale;
511 newDepthIntrinsics[3] *=
scale;
514 else if(depthWidth ==240 && depthHeight==180)
521 if (resolutions.size()>0) {
522 mTOFAvailable =
true;
523 if(newDepthIntrinsics!=null) {
524 depthIntrinsics = newDepthIntrinsics;
529 Log.i(TAG,
"TOF_available: " + mTOFAvailable);
538 if (mTOFAvailable && cameraId.compareTo(depthCameraId) == 0) {
539 sharedCamera.setAppSurfaces(this.cameraId, Arrays.asList(mTOFImageReader.
imageReader.getSurface()));
545 CameraDevice.StateCallback wrappedCallback = sharedCamera.createARDeviceStateCallback(
cameraDeviceCallback, backgroundHandler);
548 cameraManager.openCamera(cameraId, wrappedCallback, backgroundHandler);
550 if(mTOFAvailable && cameraId.compareTo(depthCameraId) != 0)
555 }
catch (CameraAccessException e) {
556 Log.e(TAG,
"Failed to open camera", e);
558 }
catch (IllegalArgumentException e) {
559 Log.e(TAG,
"Failed to open camera", e);
561 }
catch (SecurityException e) {
562 Log.e(TAG,
"Failed to open camera", e);
570 final float m00 = R[0];
571 final float m10 = R[1];
572 final float m20 = R[2];
573 final float m01 = R[4];
574 final float m11 = R[5];
575 final float m21 = R[6];
576 final float m02 = R[8];
577 final float m12 = R[9];
578 final float m22 = R[10];
580 float tr = m00 + m11 + m22;
583 float S = (float) Math.sqrt(tr + 1.0) * 2;
585 q[1] = (m21 - m12) / S;
586 q[2] = (m02 - m20) / S;
587 q[3] = (m10 - m01) / S;
588 }
else if ((m00 > m11) & (m00 > m22)) {
589 float S = (float) Math.sqrt(1.0 + m00 - m11 - m22) * 2;
591 q[0] = (m21 - m12) / S;
593 q[2] = (m01 + m10) / S;
594 q[3] = (m02 + m20) / S;
595 }
else if (m11 > m22) {
596 float S = (float) Math.sqrt(1.0 + m11 - m00 - m22) * 2;
598 q[0] = (m02 - m20) / S;
599 q[1] = (m01 + m10) / S;
601 q[3] = (m12 + m21) / S;
603 float S = (float) Math.sqrt(1.0 + m22 - m00 - m11) * 2;
605 q[0] = (m10 - m01) / S;
606 q[1] = (m02 + m20) / S;
607 q[2] = (m12 + m21) / S;
616 Log.w(TAG,
"close()");
618 if (sharedSession != null) {
619 sharedSession.close();
620 sharedSession = null;
623 if (captureSession != null) {
624 captureSession.close();
625 captureSession = null;
627 if (cameraDevice != null) {
628 cameraDevice.close();
632 mTOFImageReader.
close();
634 if(cameraTextureId>=0)
636 GLES20.glDeleteTextures(1,
new int[] {cameraTextureId}, 0);
644 if(sharedSession!=null)
645 sharedSession.setDisplayGeometry(rotation, width, height);
650 public void updateGL() throws CameraNotAvailableException {
652 if(!mReady.get() || sharedSession == null)
657 if (mTOFAvailable && mTOFImageReader.
frameCount == 0)
return;
662 frame = sharedSession.update();
663 }
catch (Exception
e) {
668 Camera camera = null;
670 camera = frame.getCamera();
673 Log.e(TAG, String.format(
"frame.getCamera() null!"));
677 if (camera == null) {
678 Log.e(TAG, String.format(
"camera is null!"));
681 if (camera.getTrackingState() != TrackingState.TRACKING) {
682 final String trackingState = camera.getTrackingState().toString();
683 Log.e(TAG, String.format(
"Tracking lost! state=%s", trackingState));
686 mActivity.runOnUiThread(
new Runnable() {
688 if(mToast!=null && previousAnchorPose != null)
690 String msg =
"Tracking lost! If you are mapping, you will need to relocalize before continuing.";
691 if(mToast.getView() == null || !mToast.getView().isShown())
693 mToast.makeText(mActivity.getApplicationContext(),
694 msg, Toast.LENGTH_LONG).show();
700 previousAnchorPose = null;
707 if (frame.getTimestamp() != 0) {
708 Pose pose = camera.getPose();
711 if(previousAnchorPose == null || mARCoreLocalizationFilteringSpeed==0)
717 float[] t = previousAnchorPose.inverse().compose(pose).getTranslation();
718 final double speed = Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])/((double)(frame.getTimestamp()-
previousAnchorTimeStamp)/10e8);
719 if(speed>=mARCoreLocalizationFilteringSpeed)
721 arCoreCorrection = arCoreCorrection.compose(previousAnchorPose).compose(pose.inverse());
722 t = arCoreCorrection.getTranslation();
723 Log.e(TAG, String.format(
"POTENTIAL TELEPORTATION!!!!!!!!!!!!!! previous anchor moved (speed=%f), new arcorrection: %f %f %f", speed, t[0], t[1], t[2]));
725 t = odomPose.getTranslation();
726 float[] t2 = (arCoreCorrection.compose(pose)).getTranslation();
727 float[] t3 = previousAnchorPose.getTranslation();
728 float[] t4 = pose.getTranslation();
729 Log.e(TAG, String.format(
"Odom = %f %f %f -> %f %f %f ArCore= %f %f %f -> %f %f %f", t[0], t[1], t[2], t2[0], t2[1], t2[2], t3[0], t3[1], t3[2], t4[0], t4[1], t4[2]));
731 mActivity.runOnUiThread(
new Runnable() {
735 String msg = String.format(
"ARCore localization has been suppressed " 736 +
"because of high speed detected (%f m/s) causing a jump! You can change " 737 +
"ARCore localization filtering speed in Settings->Mapping if you are " 738 +
"indeed moving as fast.", speed);
739 if(mToast.getView() == null || !mToast.getView().isShown())
741 mToast.makeText(mActivity.getApplicationContext(), msg, Toast.LENGTH_LONG).show();
747 previousAnchorPose = null;
752 odomPose = arCoreCorrection.compose(pose);
754 previousAnchorPose = pose;
755 previousAnchorTimeStamp = frame.getTimestamp();
757 double stamp = (double)frame.getTimestamp()/10e8;
758 if(!
RTABMapActivity.
DISABLE_LOG) Log.d(TAG, String.format(
"pose=%f %f %f q=%f %f %f %f stamp=%f", odomPose.tx(), odomPose.ty(), odomPose.tz(), odomPose.qx(), odomPose.qy(), odomPose.qz(), odomPose.qw(), stamp));
761 CameraIntrinsics intrinsics = camera.getImageIntrinsics();
763 Image image = frame.acquireCameraImage();
764 if(!
RTABMapActivity.
DISABLE_LOG) Log.d(TAG, String.format(
"frame=%d vs image=%d", frame.getTimestamp(), image.getTimestamp()));
765 PointCloud cloud = frame.acquirePointCloud();
766 FloatBuffer points = cloud.getPoints();
768 if (image.getFormat() != ImageFormat.YUV_420_888) {
769 throw new IllegalArgumentException(
770 "Expected image in YUV_420_888 format, got format " + image.getFormat());
775 for(
int i =0;i<image.getPlanes().length;++i)
777 Log.d(TAG, String.format(
"Plane[%d] pixel stride = %d, row stride = %d", i, image.getPlanes()[i].getPixelStride(), image.getPlanes()[i].getRowStride()));
781 float[] fl = intrinsics.getFocalLength();
782 float[] pp = intrinsics.getPrincipalPoint();
785 ByteBuffer y = image.getPlanes()[0].getBuffer().asReadOnlyBuffer();
786 ByteBuffer u = image.getPlanes()[1].getBuffer().asReadOnlyBuffer();
787 ByteBuffer v = image.getPlanes()[2].getBuffer().asReadOnlyBuffer();
790 image.getWidth(), image.getHeight(), y.limit(), image.getFormat(), stamp));
792 float[] texCoord =
new float[8];
793 frame.transformCoordinates2d(
794 Coordinates2d.OPENGL_NORMALIZED_DEVICE_COORDINATES,
796 Coordinates2d.IMAGE_NORMALIZED,
799 float[] p =
new float[16];
800 camera.getProjectionMatrix(p, 0, 0.1
f, 100.0
f);
802 float[] viewMatrix =
new float[16];
803 arCoreCorrection.compose(camera.getDisplayOrientedPose()).
inverse().toMatrix(viewMatrix, 0);
804 float[]
quat =
new float[4];
814 depthStamp = (double)mTOFImageReader.
timestamp/10e8;
818 mTOFImageReader.
WIDTH, mTOFImageReader.
HEIGHT, depth.limit(), ImageFormat.DEPTH16, depthStamp));
822 odomPose.tx(), odomPose.ty(), odomPose.tz(), odomPose.qx(), odomPose.qy(), odomPose.qz(), odomPose.qw(),
823 fl[0], fl[1], pp[0], pp[1],
824 depthIntrinsics[0], depthIntrinsics[1], depthIntrinsics[2], depthIntrinsics[3],
825 rgbExtrinsics.tx(), rgbExtrinsics.ty(), rgbExtrinsics.tz(), rgbExtrinsics.qx(), rgbExtrinsics.qy(), rgbExtrinsics.qz(), rgbExtrinsics.qw(),
826 depthExtrinsics.tx(), depthExtrinsics.ty(), depthExtrinsics.tz(), depthExtrinsics.qx(), depthExtrinsics.qy(), depthExtrinsics.qz(), depthExtrinsics.qw(),
829 y, u, v, y.limit(), image.getWidth(), image.getHeight(), image.getFormat(),
830 depth, depth.limit(), mTOFImageReader.
WIDTH, mTOFImageReader.
HEIGHT, ImageFormat.DEPTH16,
831 points, points.limit()/4,
832 viewMatrix[12], viewMatrix[13], viewMatrix[14], quat[1], quat[2], quat[3], quat[0],
833 p[0], p[5], p[8], p[9], p[10], p[11], p[14],
834 texCoord[0],texCoord[1],texCoord[2],texCoord[3],texCoord[4],texCoord[5],texCoord[6],texCoord[7]);
840 odomPose.tx(), odomPose.ty(), odomPose.tz(), odomPose.qx(), odomPose.qy(), odomPose.qz(), odomPose.qw(),
841 fl[0], fl[1], pp[0], pp[1],
842 rgbExtrinsics.tx(), rgbExtrinsics.ty(), rgbExtrinsics.tz(), rgbExtrinsics.qx(), rgbExtrinsics.qy(), rgbExtrinsics.qz(), rgbExtrinsics.qw(),
844 y, u, v, y.limit(), image.getWidth(), image.getHeight(), image.getFormat(),
845 points, points.limit()/4,
846 viewMatrix[12], viewMatrix[13], viewMatrix[14], quat[1], quat[2], quat[3], quat[0],
847 p[0], p[5], p[8], p[9], p[10], p[11], p[14],
848 texCoord[0],texCoord[1],texCoord[2],texCoord[3],texCoord[4],texCoord[5],texCoord[6],texCoord[7]);
854 }
catch (NotYetAvailableException e) {
865 public ArrayList<String>
getResolutions (Context context, String cameraId,
int imageFormat){
866 Log.v(TAG,
"getResolutions: cameraId:" + cameraId +
" imageFormat: " + imageFormat);
868 ArrayList<String> output =
new ArrayList<String>();
870 CameraManager manager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
871 CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
873 for (android.util.Size s : characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP).getOutputSizes(imageFormat)) {
874 output.add(s.getWidth() +
"x" + s.getHeight());
876 }
catch (Exception
e) {
CaptureRequest.Builder previewCaptureRequestBuilder
void setToast(Toast toast)
void stopBackgroundThread()
static boolean DISABLE_LOG
static native void postOdometryEventDepth(long nativeApplication, float x, float y, float z, float qx, float qy, float qz, float qw, float rgb_fx, float rgb_fy, float rgb_cx, float rgb_cy, float depth_fx, float depth_fy, float depth_cx, float depth_cy, float rgbFrameX, float rgbFrameY, float rgbFrameZ, float rgbFrameQX, float rgbFrameQY, float rgbFrameQZ, float rgbFrameQW, float depthFrameX, float depthFrameY, float depthFrameZ, float depthFrameQX, float depthFrameQY, float depthFrameQZ, float depthFrameQW, double rgbStamp, double depthStamp, ByteBuffer yPlane, ByteBuffer uPlane, ByteBuffer vPlane, int yPlaneLen, int rgbWidth, int rgbHeight, int rgbFormat, ByteBuffer depth, int depthLen, int depthWidth, int depthHeight, int depthFormat, FloatBuffer points, int pointsLen, float vx, float vy, float vz, float vqx, float vqy, float vqz, float vqw, float p00, float p11, float p02, float p12, float p22, float p32, float p23, float t0, float t1, float t2, float t3, float t4, float t5, float t6, float t7)
static void rotationMatrixToQuaternion(float[] R, float[] q)
void createCameraPreviewSession()
static native void postCameraPoseEvent(long nativeApplication, float x, float y, float z, float qx, float qy, float qz, float qw, double stamp)
static final float [] QUAD_COORDS
void run(class_loader::ClassLoader *loader)
void startBackgroundThread()
HandlerThread backgroundThread
highp_quat quat
Quaternion of default single-precision floating-point numbers.
CameraCaptureSession captureSession
GLM_FUNC_DECL genType e()
CameraDevice cameraDevice
boolean isDepthSupported()
final CameraDevice.StateCallback cameraDeviceCallback
CameraManager cameraManager
final CameraDevice.StateCallback cameraDeviceCallback
static long nativeApplication
final CameraCaptureSession.CaptureCallback captureSessionCallback
ArrayList< String > getResolutions(Context context, String cameraId, int imageFormat)
GLSurfaceView surfaceView
static boolean contains(int[] modes, int mode)
float mARCoreLocalizationFilteringSpeed
Handler backgroundHandler
void setRepeatingCaptureRequest()
GLM_FUNC_DECL detail::tquat< T, P > rotation(detail::tvec3< T, P > const &orig, detail::tvec3< T, P > const &dest)
void startBackgroundThread()
static native void postOdometryEvent(long nativeApplication, float x, float y, float z, float qx, float qy, float qz, float qw, float rgb_fx, float rgb_fy, float rgb_cx, float rgb_cy, float rgbFrameX, float rgbFrameY, float rgbFrameZ, float rgbFrameQX, float rgbFrameQY, float rgbFrameQZ, float rgbFrameQW, double stamp, ByteBuffer yPlane, ByteBuffer uPlane, ByteBuffer vPlane, int yPlaneLen, int rgbWidth, int rgbHeight, int rgbFormat, FloatBuffer points, int pointsLen, float vx, float vy, float vz, float vqx, float vqy, float vqz, float vqw, float p00, float p11, float p02, float p12, float p22, float p32, float p23, float t0, float t1, float t2, float t3, float t4, float t5, float t6, float t7)
void stopBackgroundThread()
void createImageReader(int width, int height)
long previousAnchorTimeStamp
SharedCamera sharedCamera
Handler backgroundHandler
void setDisplayGeometry(int rotation, int width, int height)
static RTABMapActivity mActivity
ARCoreSharedCamera(RTABMapActivity c, float arCoreLocalizationFilteringSpeed)
TOF_ImageReader mTOFImageReader
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)