Skip to content

android-intrinsics-extrinsics-utils-functions - #6818

Merged
ev-mp merged 6 commits into
realsenseai:developmentfrom
remibettan:android-utils-deproj-trans-proj
Jul 20, 2020
Merged

android-intrinsics-extrinsics-utils-functions#6818
ev-mp merged 6 commits into
realsenseai:developmentfrom
remibettan:android-utils-deproj-trans-proj

Conversation

@remibettan

@remibettan remibettan commented Jul 13, 2020

Copy link
Copy Markdown
Contributor

Android Wrapper - API functions added:
rs2_deproject_pixel_to_point
rs2_transform_point_to_point
rs2_project_point_to_pixel
rs2_fov
rs2_project_color_pixel_to_depth_pixel

Triggered by jira ticket: DSO-15199

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several comments to review.
Can you add the unit-test as well ?

Comment thread src/android/jni/utils.cpp Outdated
Comment thread src/android/jni/utils.cpp Outdated
Comment thread src/android/jni/utils.cpp Outdated
jclass pixel_2D_class = env->GetObjectClass(pixel_2D);
jfieldID pixel_x_field = env->GetFieldID(pixel_2D_class, "mX", "I");
jfieldID pixel_y_field = env->GetFieldID(pixel_2D_class, "mY", "I");
float* pixel = new float[2];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/android/jni/utils.cpp Outdated
Comment thread src/android/jni/utils.cpp Outdated
@@ -0,0 +1,6 @@
# Android Wrapper Code Fragments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/android/jni/utils.cpp Outdated

// helper method for retrieving float[3] from Point_3D object
std::shared_ptr<float> retrievePoint3D(JNIEnv *env, jobject point_3D) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
Log.d(TAG, "depth = " + depthAtMiddleOfFrame);
Pixel depth_pixel = new Pixel(w/2, h/2);
Point_3D depth_point = Utils.deprojectPixelToPoint(depthFrameIntrinsic, depth_pixel, depthAtMiddleOfFrame );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The projection API calls receive distance in meters, not raw.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/android/jni/utils.cpp Outdated
jfieldID to_pixel_y_field = env->GetFieldID(to_pixel_class, "mY", "F");
env->SetFloatField(toPixel, to_pixel_x_field, to_pixel[0]);
env->SetFloatField(toPixel, to_pixel_y_field, to_pixel[1]);
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread src/android/jni/utils.cpp Outdated

// retrieving rs2_intrinsics from intrinsic object
// helper method for retrieving rs2_intrinsics from intrinsic object
rs2_intrinsics retrieveIntrinsic(JNIEnv *env, jobject intrinsic) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name retireveIntrinsic is more appropriate in the context of stream/frame profile.
Can we consider intrinsic_jni2rs or similar?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - changed to intrinsic_jobject2rs

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comments for the extension

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ev-mp
ev-mp changed the base branch from ac to development July 20, 2020 15:47
@ev-mp
ev-mp merged commit 1edff05 into realsenseai:development Jul 20, 2020
@remibettan
remibettan deleted the android-utils-deproj-trans-proj branch July 29, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants