Utils.java
Go to the documentation of this file.
1 package com.intel.realsense.librealsense;
2 
3 
4 public class Utils {
5 
6  // Given a point in 3D space, compute the corresponding pixel coordinates in an image
7  // with no distortion or forward distortion coefficients produced by the same camera
8  public static Pixel projectPointToPixel(final Intrinsic intrinsic, final Point_3D point) {
9  Pixel rv = new Pixel();
10  nProjectPointToPixel(rv, intrinsic, point);
11  return rv;
12  }
13 
14  // Given pixel coordinates and depth in an image with no distortion or inverse distortion coefficients,
15  // compute the corresponding point in 3D space relative to the same camera
16  public static Point_3D deprojectPixelToPoint(final Intrinsic intrinsic, final Pixel pixel, final float depth) {
17  Point_3D rv = new Point_3D();
18  nDeprojectPixelToPoint(rv, intrinsic, pixel, depth);
19  return rv;
20  }
21 
22  // Transform 3D coordinates relative to one sensor to 3D coordinates relative to another viewpoint
23  public static Point_3D transformPointToPoint(final Extrinsic extrinsic, final Point_3D from_point) {
24  Point_3D rv = new Point_3D();
25  nTransformPointToPoint(rv, extrinsic, from_point);
26  return rv;
27  }
28 
29  private static class Fov {
30  public float mFovX;
31  public float mFovY;
32 
33  public Fov() {
34  mFovX = 0.f;
35  mFovY = 0.f;
36  }
37  }
38 
39  public static float[] getFov(final Intrinsic intrinsic) {
40  float[] rv = new float[2];
41  Fov fov = new Fov();
42  nGetFov(fov, intrinsic);
43  rv[0] = fov.mFovX;
44  rv[1] = fov.mFovY;
45  return rv;
46  }
47 
48  public static Pixel project2dPixelToDepthPixel(final DepthFrame depthFrame, float depthScale,
49  float depthMin, float depthMax,
50  final Intrinsic depthIntrinsic, final Intrinsic otherIntrinsic,
51  final Extrinsic otherToDepth, final Extrinsic depthToOther,
52  final Pixel fromPixel) {
53  Pixel rv = new Pixel();
54  nProject2dPixelToDepthPixel(rv, depthFrame.getHandle(), depthScale, depthMin, depthMax,
55  depthIntrinsic, otherIntrinsic, otherToDepth, depthToOther, fromPixel);
56  return rv;
57  }
58 
59 
60  private native static void nProjectPointToPixel(Pixel pixel, Intrinsic intrinsic, Point_3D point_3D);
61  private native static void nDeprojectPixelToPoint(Point_3D point_3D, Intrinsic intrinsic, Pixel pixel, float depth);
62  private native static void nTransformPointToPoint(Point_3D to_point_3D, Extrinsic extrinsic, Point_3D from_point_3D);
63  private native static void nGetFov(Fov fov, Intrinsic intrinsic);
64  private native static void nProject2dPixelToDepthPixel(Pixel toPixel, long depthFrameHandle, float depthScale,
65  float depthMin, float depthMax,
66  Intrinsic depthIntrinsic, Intrinsic otherIntrinsic,
67  Extrinsic otherToDepth, Extrinsic depthToOther,
68  Pixel fromPixel);
69 }
static native void nProject2dPixelToDepthPixel(Pixel toPixel, long depthFrameHandle, float depthScale, float depthMin, float depthMax, Intrinsic depthIntrinsic, Intrinsic otherIntrinsic, Extrinsic otherToDepth, Extrinsic depthToOther, Pixel fromPixel)
GLint GLint GLsizei GLsizei GLsizei depth
point
Definition: rmse.py:166
static native void nProjectPointToPixel(Pixel pixel, Intrinsic intrinsic, Point_3D point_3D)
static float[] getFov(final Intrinsic intrinsic)
Definition: Utils.java:39
static native void nGetFov(Fov fov, Intrinsic intrinsic)
static native void nDeprojectPixelToPoint(Point_3D point_3D, Intrinsic intrinsic, Pixel pixel, float depth)
static Pixel projectPointToPixel(final Intrinsic intrinsic, final Point_3D point)
Definition: Utils.java:8
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)
Definition: Utils.java:48
static Point_3D deprojectPixelToPoint(final Intrinsic intrinsic, final Pixel pixel, final float depth)
Definition: Utils.java:16
static Point_3D transformPointToPoint(final Extrinsic extrinsic, final Point_3D from_point)
Definition: Utils.java:23
static native void nTransformPointToPoint(Point_3D to_point_3D, Extrinsic extrinsic, Point_3D from_point_3D)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:13