[D455] Compare Two Ways To Get World Coordinates
Hi,
There are two ways to get world coordinates.
No.1: Using deproject
No.2: I set up a resolution of 1280x720. I will calculate points, calculate vertices with dims=3. I will get array A(720, 1280, 3). Then if I want to get the world coordinates of pixel (a,b), I will get from array A by A[b,a].
My questions are:
1. In the previous questions, I get information that No.2 is better than No.1. So why does Intel create these 2 ways? Why do they not use only No.2?
2. I tested and saw world coordinates from python code (after aligning, postprocessing, points,...) still differ from the world coordinates of IntelRealSenseViewer. Do I miss anything?
Thanks
-
Hi Nguyenduyduc14. Thanks very much for your questions.
1. Deprojection is an advanced programming technique compared to the simplicity of generating a pointcloud with pc.calculate and retrieving its vertices and so can offer advantages over pc.calculate despite the slightly lesser accuracy of align + deproject compared to vertices. An example would be converting a 3D pointcloud generated with rs2_deproject_pixel_to_point back to 2D pixels with rs2_project_point_to_pixel
There are often a range of different ways in the RealSense SDK to accomplish the same goal, making the SDK a very flexible and powerful programming environment.
2. If you program your Python application to apply the same post-processing filters as the Viewer then you may still see differences in your Python program compared to the Viewer depending on what programming methods you used. For example, if you performed depth-color alignment and then used the get_distance() instruction, you may observe accurate Z-depth values at the center of the image but increasing drifts in the accuracy of Z as you move further out from the center of the image along the X and Y axes. Using aligned intrinsics may help to improve accuracy.
-
Thank you very much.
But could you make "aligned intrinsics" clearer?
Now my process is:
1. Take a depth frame, a color frame
2. Postprocess this depth frame
3. Align the new depth frame to this color frame
4. Map the new depth frame to this color frame
5. Calculate points from the new depth frame
6. Use get_vertices(dims=3) from the new points to get an array (720x1280x3).
7. Then if I want to get the world coordinate at pixel (x=300,y=400), I will get (x,y,z) from this array[400,300].
If I want to use intrinsics, I have to get intrinsics from this color frame then using rs2_deproject...(this intrinsics, [400,300], depthFrame[400,300])
So,
1. Which one is better?
2. What does "Using aligned intrinsics may help to improve accuracy" mean? How to implement it?
Thanks
-
Whether you use the intrinsics of the stream that you are aligning to or the 'aligned intrinsics', both methods should provide the same results, as discussed by a RealSense team member here:
https://github.com/IntelRealSense/librealsense/issues/3735#issuecomment-482933434
My understanding is that 'aligned intrinsics' involves accessing the intrinsics through the video stream profile like the Python script at the link below.
https://github.com/IntelRealSense/librealsense/issues/1231#issuecomment-464737908
I quote the align section of that script here:
# Align the depth frame to color frame
aligned_frames = align.process(frames)
# Get aligned frames
depth_frame = aligned_frames.get_depth_frame()
color_frame = aligned_frames.get_color_frame()
depth_intrin = depth_frame.profile.as_video_stream_profile().intrinsics
Please sign in to leave a comment.
Comments
3 comments