frame.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #include <jni.h>
5 #include "error.h"
6 #include "../../../include/librealsense2/rs.h"
7 
8 extern "C" JNIEXPORT void JNICALL
10  rs2_error *e = NULL;
11  rs2_frame_add_ref((rs2_frame *) handle, &e);
12  handle_error(env, e);
13 }
14 
15 extern "C" JNIEXPORT void JNICALL
17  rs2_release_frame((rs2_frame *) handle);
18 }
19 
20 extern "C" JNIEXPORT jlong JNICALL
22  rs2_error *e = NULL;
24  reinterpret_cast<const rs2_frame *>(handle), &e);
25  handle_error(env, e);
26  return (jlong) rv;
27 }
28 
29 extern "C"
30 JNIEXPORT jint JNICALL
32 
33  rs2_error *e = NULL;
34  auto rv = rs2_get_frame_data_size(reinterpret_cast<const rs2_frame *>(handle), &e);
35  handle_error(env, e);
36  return (jint)rv;
37 }
38 
39 extern "C" JNIEXPORT void JNICALL
41  jbyteArray data_) {
42  jsize length = env->GetArrayLength(data_);
43  rs2_error *e = NULL;
44  env->SetByteArrayRegion(data_, 0, length, static_cast<const jbyte *>(rs2_get_frame_data(
45  reinterpret_cast<const rs2_frame *>(handle), &e)));
46  handle_error(env, e);
47 }
48 
49 extern "C"
50 JNIEXPORT void JNICALL
52  jfloatArray data_) {
53  jsize length = env->GetArrayLength(data_);
54  rs2_error *e = NULL;
55  env->SetFloatArrayRegion(data_, 0, length, static_cast<const jfloat *>(rs2_get_frame_data(
56  reinterpret_cast<const rs2_frame *>(handle), &e)));
57  handle_error(env, e);
58 }
59 
60 extern "C"
61 JNIEXPORT void JNICALL
63  jlong handle,
64  jfloatArray data_) {
65  jsize length = env->GetArrayLength(data_);
66  rs2_error *e = NULL;
67  env->SetFloatArrayRegion(data_, 0, length, reinterpret_cast<const jfloat *>(rs2_get_frame_texture_coordinates(
68  reinterpret_cast<const rs2_frame *>(handle), &e)));
69  handle_error(env, e);
70 }
71 
72 extern "C" JNIEXPORT jboolean JNICALL
74  jlong handle, jint extension) {
75  rs2_error *e = NULL;
76  int rv = rs2_is_frame_extendable_to(reinterpret_cast<const rs2_frame *>(handle),
77  static_cast<rs2_extension>(extension), &e);
78  handle_error(env, e);
79  return rv;
80 }
81 
82 extern "C" JNIEXPORT jint JNICALL
84  rs2_error *e = NULL;
85  int rv = rs2_get_frame_width(reinterpret_cast<const rs2_frame *>(handle), &e);
86  handle_error(env, e);
87  return rv;
88 }
89 
90 extern "C" JNIEXPORT jint JNICALL
92  rs2_error *e = NULL;
93  int rv = rs2_get_frame_height(reinterpret_cast<const rs2_frame *>(handle), &e);
94  handle_error(env, e);
95  return rv;
96 }
97 
98 extern "C" JNIEXPORT jint JNICALL
100  jlong handle) {
101  rs2_error *e = NULL;
102  int rv = rs2_get_frame_stride_in_bytes(reinterpret_cast<const rs2_frame *>(handle), &e);
103  handle_error(env, e);
104  return rv;
105 }
106 
107 extern "C" JNIEXPORT jint JNICALL
109  jlong handle) {
110  rs2_error *e = NULL;
111  int rv = rs2_get_frame_bits_per_pixel(reinterpret_cast<const rs2_frame *>(handle), &e);
112  handle_error(env, e);
113  return rv;
114 }
115 
116 extern "C" JNIEXPORT jint JNICALL
118  rs2_error *e = NULL;
119  unsigned long long rv = rs2_get_frame_number(reinterpret_cast<const rs2_frame *>(handle), &e);
120  handle_error(env, e);
121  return rv;
122 }
123 
124 extern "C" JNIEXPORT jfloat JNICALL
126  jlong handle, jint x, jint y) {
127  rs2_error *e = NULL;
128  float rv = rs2_depth_frame_get_distance(reinterpret_cast<const rs2_frame *>(handle), x, y, &e);
129  handle_error(env, e);
130  return rv;
131 }
132 
133 extern "C" JNIEXPORT jfloat JNICALL
135  rs2_error *e = NULL;
136  float rv = rs2_depth_frame_get_units( reinterpret_cast<const rs2_frame *>(handle), &e );
137  handle_error( env, e );
138  return rv;
139 }
140 
141 extern "C" JNIEXPORT jint JNICALL
143  rs2_error *e = NULL;
144  int rv = rs2_get_frame_points_count(reinterpret_cast<const rs2_frame *>(handle), &e);
145  handle_error(env, e);
146  return rv;
147 }
148 
149 extern "C"
150 JNIEXPORT void JNICALL
152  jstring filePath_, jlong textureHandle) {
153  const char *filePath = env->GetStringUTFChars(filePath_, 0);
154  rs2_error *e = NULL;
155  rs2_export_to_ply(reinterpret_cast<const rs2_frame *>(handle), filePath,
156  reinterpret_cast<rs2_frame *>(textureHandle), &e);
157  handle_error(env, e);
158  env->ReleaseStringUTFChars(filePath_, filePath);
159 }
160 
161 extern "C" JNIEXPORT jdouble JNICALL
163  rs2_error *e = NULL;
164  double rv = rs2_get_frame_timestamp(reinterpret_cast<const rs2_frame *>(handle), &e);
165  handle_error(env, e);
166  return rv;
167 }
168 
169 extern "C" JNIEXPORT jint JNICALL
171  jlong handle) {
172  rs2_error *e = NULL;
173  int rv = rs2_get_frame_timestamp_domain(reinterpret_cast<const rs2_frame *>(handle), &e);
174  handle_error(env, e);
175  return rv;
176 }
177 
178 extern "C" JNIEXPORT jlong JNICALL
180  jint metadata_type) {
181  rs2_error *e = NULL;
182  long rv = rs2_get_frame_metadata(reinterpret_cast<const rs2_frame *>(handle),
183  static_cast<rs2_frame_metadata_value>(metadata_type), &e);
184  handle_error(env, e);
185  return rv;
186 }
187 
188 extern "C" JNIEXPORT jboolean JNICALL
190  jint metadata_type) {
191  rs2_error *e = NULL;
192  int rv = rs2_supports_frame_metadata(reinterpret_cast<const rs2_frame *>(handle),
193  static_cast<rs2_frame_metadata_value>(metadata_type), &e);
194  handle_error(env, e);
195  return rv > 0;
196 }
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, rs2_error **error)
Definition: rs.cpp:2162
float rs2_depth_frame_get_units(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2356
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Frame_nGetData(JNIEnv *env, jclass type, jlong handle, jbyteArray data_)
Definition: frame.cpp:40
GLint y
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Frame_nGetStreamProfile(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:21
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2179
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:971
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_Points_nGetCount(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:142
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
Definition: rs.cpp:1461
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_VideoFrame_nGetHeight(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:91
GLuint64 GLenum void * handle
Definition: glext.h:7785
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Points_nGetData(JNIEnv *env, jclass type, jlong handle, jfloatArray data_)
Definition: frame.cpp:51
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Frame_nSupportsMetadata(JNIEnv *env, jclass type, jlong handle, jint metadata_type)
Definition: frame.cpp:189
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Points_nGetTextureCoordinates(JNIEnv *env, jclass type, jlong handle, jfloatArray data_)
Definition: frame.cpp:62
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_Frame_nIsFrameExtendableTo(JNIEnv *env, jclass type, jlong handle, jint extension)
Definition: frame.cpp:73
void handle_error(JNIEnv *env, rs2_error *error)
Definition: error.cpp:6
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:908
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2171
JNIEXPORT jfloat JNICALL Java_com_intel_realsense_librealsense_DepthFrame_nGetDistance(JNIEnv *env, jclass type, jlong handle, jint x, jint y)
Definition: frame.cpp:125
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs.cpp:838
e
Definition: rmse.py:177
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:955
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_Frame_nGetTimestampDomain(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:170
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:963
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_VideoFrame_nGetWidth(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:83
JNIEXPORT jfloat JNICALL Java_com_intel_realsense_librealsense_DepthFrame_nGetUnits(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:134
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_Frame_nGetDataSize(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:31
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:947
GLdouble x
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
Definition: rs.cpp:2346
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_VideoFrame_nGetStride(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:99
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
Definition: rs.cpp:915
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_VideoFrame_nGetBitsPerPixel(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:108
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Frame_nRelease(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:16
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Points_nExportToPly(JNIEnv *env, jclass type, jlong handle, jstring filePath_, jlong textureHandle)
Definition: frame.cpp:151
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:986
int rs2_get_frame_data_size(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:933
JNIEXPORT jdouble JNICALL Java_com_intel_realsense_librealsense_Frame_nGetTimestamp(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:162
JNIEXPORT jint JNICALL Java_com_intel_realsense_librealsense_Frame_nGetNumber(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:117
GLenum type
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:1015
#define NULL
Definition: tinycthread.c:47
GLenum GLuint GLenum GLsizei length
JNIEXPORT jlong JNICALL Java_com_intel_realsense_librealsense_Frame_nGetMetadata(JNIEnv *env, jclass type, jlong handle, jint metadata_type)
Definition: frame.cpp:179
void rs2_release_frame(rs2_frame *frame)
Definition: rs.cpp:993
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs.cpp:846
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_Frame_nAddRef(JNIEnv *env, jclass type, jlong handle)
Definition: frame.cpp:9
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:978
struct rs2_frame rs2_frame
Definition: rs_types.h:261
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:940


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