7 #include "../../../include/librealsense2/rs.h" 9 extern "C" JNIEXPORT
void JNICALL
22 jclass clazz = env->GetObjectClass(params);
24 jfieldID typeField = env->GetFieldID(clazz,
"type",
"I");
25 jfieldID formatField = env->GetFieldID(clazz,
"format",
"I");
26 jfieldID indexField = env->GetFieldID(clazz,
"index",
"I");
27 jfieldID uniqueIdField = env->GetFieldID(clazz,
"uniqueId",
"I");
28 jfieldID frameRateField = env->GetFieldID(clazz,
"frameRate",
"I");
30 env->SetIntField(params, typeField, stream_type);
31 env->SetIntField(params, formatField, format);
32 env->SetIntField(params, indexField, index);
33 env->SetIntField(params, uniqueIdField, uniqueId);
34 env->SetIntField(params, frameRateField, frameRate);
37 extern "C" JNIEXPORT
void JNICALL
48 jclass clazz = env->GetObjectClass(params);
50 jfieldID widthField = env->GetFieldID(clazz,
"width",
"I");
51 jfieldID heightField = env->GetFieldID(clazz,
"height",
"I");
53 env->SetIntField(params, widthField, width);
54 env->SetIntField(params, heightField, height);
57 extern "C" JNIEXPORT
void JNICALL
64 JNIEXPORT jboolean JNICALL
70 static_cast<rs2_extension>(extension), &e);
76 JNIEXPORT
void JNICALL
78 jlong
handle, jlong otherHandle,
83 reinterpret_cast<const rs2_stream_profile *>(otherHandle),&extr, &e);
91 jclass clazz = env->GetObjectClass(extrinsic);
95 jfieldID rotation_field = env->GetFieldID(clazz,
"mRotation",
"[F");
96 jfloatArray rotationArray = env->NewFloatArray(9);
97 if (rotationArray !=
NULL)
99 env->SetFloatArrayRegion(rotationArray, 0, 9, reinterpret_cast<jfloat*>(&extr.
rotation));
101 env->SetObjectField(extrinsic, rotation_field, rotationArray);
104 jfieldID translation_field = env->GetFieldID(clazz,
"mTranslation",
"[F");
105 jfloatArray translationArray = env->NewFloatArray(3);
106 if (translationArray !=
NULL)
108 env->SetFloatArrayRegion(translationArray, 0, 3, reinterpret_cast<jfloat*>(&extr.
translation));
110 env->SetObjectField(extrinsic, translation_field, translationArray);
114 JNIEXPORT
void JNICALL
116 jlong fromHandle, jlong toHandle,
123 jclass clazz = env->GetObjectClass(extrinsic);
125 jfieldID rotation_field = env->GetFieldID(clazz,
"mRotation",
"[F");
126 jobject rotationObject = env->GetObjectField(extrinsic, rotation_field);
127 jfloatArray* rotationArray =
reinterpret_cast<jfloatArray *
>(&rotationObject);
128 jfloat *
rotation = env->GetFloatArrayElements(*rotationArray,
NULL);
129 memcpy(extr.
rotation, rotation, 9 *
sizeof(
float));
130 env->ReleaseFloatArrayElements(*rotationArray, rotation, 0);
132 jfieldID translation_field = env->GetFieldID(clazz,
"mTranslation",
"[F");
133 jobject translationObject = env->GetObjectField(extrinsic, translation_field);
134 jfloatArray* translationArray =
reinterpret_cast<jfloatArray *
>(&translationObject);
135 jfloat * translation = env->GetFloatArrayElements(*translationArray,
NULL);
136 memcpy(extr.
translation, translation, 3 *
sizeof(
float));
137 env->ReleaseFloatArrayElements(*translationArray, translation, 0);
141 reinterpret_cast<const rs2_stream_profile *>(toHandle), extr, &e);
146 JNIEXPORT
void JNICALL
148 jlong
handle, jobject intrinsic) {
159 jclass clazz = env->GetObjectClass(intrinsic);
162 jfieldID width_field = env->GetFieldID(clazz,
"mWidth",
"I");
163 jfieldID height_field = env->GetFieldID(clazz,
"mHeight",
"I");
164 jfieldID ppx_field = env->GetFieldID(clazz,
"mPpx",
"F");
165 jfieldID ppy_field = env->GetFieldID(clazz,
"mPpy",
"F");
166 jfieldID fx_field = env->GetFieldID(clazz,
"mFx",
"F");
167 jfieldID fy_field = env->GetFieldID(clazz,
"mFy",
"F");
168 jfieldID model_field = env->GetFieldID(clazz,
"mModelValue",
"I");
171 env->SetIntField(intrinsic, width_field, intr.
width);
172 env->SetIntField(intrinsic, height_field, intr.
height);
173 env->SetFloatField(intrinsic, ppx_field, intr.
ppx);
174 env->SetFloatField(intrinsic, ppy_field, intr.
ppy);
175 env->SetFloatField(intrinsic, fx_field, intr.
fx);
176 env->SetFloatField(intrinsic, fy_field, intr.
fy);
177 env->SetIntField(intrinsic, model_field, intr.
model);
180 jfieldID coeff_field = env->GetFieldID(clazz,
"mCoeffs",
"[F");
181 jfloatArray coeffsArray = env->NewFloatArray(5);
182 if (coeffsArray !=
NULL)
184 env->SetFloatArrayRegion(coeffsArray, 0, 5, reinterpret_cast<jfloat*>(&intr.
coeffs));
186 env->SetObjectField(intrinsic, coeff_field, coeffsArray);
190 JNIEXPORT
void JNICALL
192 jlong
handle, jobject intrinsic) {
203 jclass clazz = env->GetObjectClass(intrinsic);
207 jfieldID data_field = env->GetFieldID(clazz,
"mData",
"[F");
208 jfloatArray dataArray = env->NewFloatArray(12);
209 if (dataArray !=
NULL)
211 env->SetFloatArrayRegion(dataArray, 0, 12, reinterpret_cast<jfloat*>(&intr.
data));
213 env->SetObjectField(intrinsic, data_field, dataArray);
216 jfieldID noise_field = env->GetFieldID(clazz,
"mNoiseVariances",
"[F");
217 jfloatArray noiseArray = env->NewFloatArray(3);
218 if (noiseArray !=
NULL)
220 env->SetFloatArrayRegion(noiseArray, 0, 3, reinterpret_cast<jfloat*>(&intr.
noise_variances));
222 env->SetObjectField(intrinsic, noise_field, noiseArray);
225 jfieldID bias_field = env->GetFieldID(clazz,
"mBiasVariances",
"[F");
226 jfloatArray biasArray = env->NewFloatArray(3);
227 if (biasArray !=
NULL)
229 env->SetFloatArrayRegion(biasArray, 0, 3, reinterpret_cast<jfloat*>(&intr.
bias_variances));
231 env->SetObjectField(intrinsic, bias_field, biasArray);
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
GLuint64 GLenum void * handle
void handle_error(JNIEnv *env, rs2_error *error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_MotionStreamProfile_nGetIntrinsic(JNIEnv *env, jclass type, jlong handle, jobject intrinsic)
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_StreamProfile_nDelete(JNIEnv *env, jclass type, jlong handle)
void rs2_get_stream_profile_data(const rs2_stream_profile *mode, rs2_stream *stream, rs2_format *format, int *index, int *unique_id, int *framerate, rs2_error **error)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_VideoStreamProfile_nGetIntrinsic(JNIEnv *env, jclass type, jlong handle, jobject intrinsic)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_StreamProfile_nGetProfile(JNIEnv *env, jclass type, jlong handle, jobject params)
void rs2_delete_stream_profile(rs2_stream_profile *mode)
GLint GLsizei GLsizei height
GLint GLint GLsizei GLint GLenum format
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_VideoStreamProfile_nGetResolution(JNIEnv *env, jclass type, jlong handle, jobject params)
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_StreamProfile_nGetExtrinsicTo(JNIEnv *env, jclass type, jlong handle, jlong otherHandle, jobject extrinsic)
rs2_format
A stream's format identifies how binary data is encoded within a frame.
GLenum const GLfloat * params
JNIEXPORT jboolean JNICALL Java_com_intel_realsense_librealsense_StreamProfile_nIsProfileExtendableTo(JNIEnv *env, jclass type, jlong handle, jint extension)
rs2_stream
Streams are different types of data provided by RealSense devices.
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Motion device intrinsics: scale, bias, and variances.
JNIEXPORT void JNICALL Java_com_intel_realsense_librealsense_StreamProfile_nRegisterExtrinsic(JNIEnv *env, jclass type, jlong fromHandle, jlong toHandle, jobject extrinsic)
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)