View my account

[D455] Compare Two Ways To Get World Coordinates

Comments

3 comments

  • MartyG

    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.

    0
    Comment actions Permalink
  • Nguyenduyduc14

    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

     

    0
    Comment actions Permalink
  • MartyX Grover

    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

    0
    Comment actions Permalink

Please sign in to leave a comment.