1 package com.intel.realsense.capture;
3 import android.Manifest;
4 import android.content.Context;
5 import android.content.pm.PackageManager;
6 import android.os.Bundle;
7 import android.os.Handler;
8 import androidx.core.app.ActivityCompat;
9 import androidx.core.content.ContextCompat;
10 import androidx.appcompat.app.AppCompatActivity;
11 import android.util.Log;
12 import android.view.View;
13 import android.widget.TextView;
43 Runnable mStreaming =
new Runnable() {
49 mGLSurfaceView.upload(processed);
50 if((++framesCounter % 80) == 0) {
53 Intrinsic depthFrameIntrinsic = depthFrame.getProfile().getIntrinsic();
56 Log.d(
TAG,
"fov = (" + fov[0] +
", " + fov[1] +
")");
61 Extrinsic depthToColorExtrinsic = depthFrame.getProfile().getExtrinsicTo(colorFrame.
getProfile());
66 byte[] depthFrameData =
new byte[ w *
h ];
67 depthFrame.getData(depthFrameData);
68 float depthDataAtMiddleOfFrame = depthFrameData[w * h / 2];
69 int halfWidth = w / 2;
70 while (depthDataAtMiddleOfFrame < 0.2) {
72 depthDataAtMiddleOfFrame = depthFrameData[halfWidth *
h];
75 float depthAtMiddleOfFrame = depthFrame.getDistance(halfWidth, h / 2);
76 Log.d(
TAG,
"depth = " + depthAtMiddleOfFrame);
82 Log.d(
TAG,
"depthPoint = (" + depth_point.
mX +
", " + depth_point.
mY +
", " + depth_point.
mZ +
")");
83 Log.d(
TAG,
"colorPoint = (" + color_point.
mX +
", " + color_point.
mY +
", " + color_point.
mZ +
")");
84 Log.d(
TAG,
"pixel = (" + depth_pixel.
mX +
", " + depth_pixel.
mY +
")");
85 Log.d(
TAG,
"color pixel = (" + color_pixel.
mX +
", " + color_pixel.
mY +
")");
87 float depthMin = 0.1f;
88 float depthMax = 10.f;
90 depthFrameIntrinsic, colorFrameIntrinsic, colorToDepthExtrinsic, depthToColorExtrinsic, color_pixel);
91 Log.d(
TAG,
"to_pixel = (" + toPixel.
mX +
", " + toPixel.
mY +
")");
95 mHandler.post(mStreaming);
98 Log.e(
TAG,
"streaming, error: " + e.getMessage());
::rosgraph_msgs::Log_< std::allocator< void > > Log
GLdouble GLdouble GLdouble w
Extrinsic getExtrinsicTo(StreamProfile other)
GLfloat GLfloat GLfloat GLfloat h
static float[] getFov(final Intrinsic intrinsic)
VideoStreamProfile getProfile()
def run(include_folder_path, addon_folder_path)
static Pixel projectPointToPixel(final Intrinsic intrinsic, final Point_3D point)
static Pixel project2dPixelToDepthPixel(final DepthFrame depthFrame, float depthScale, float depthMin, float depthMax, final Intrinsic depthIntrinsic, final Intrinsic otherIntrinsic, final Extrinsic otherToDepth, final Extrinsic depthToOther, final Pixel fromPixel)
static Point_3D deprojectPixelToPoint(final Intrinsic intrinsic, final Pixel pixel, final float depth)
static Point_3D transformPointToPoint(final Extrinsic extrinsic, final Point_3D from_point)