View my account

Are color images and depth images aligned frame by frame?Whether the depth to point cloud can be directly calculated by internal and external parameters?

Comments

4 comments

  • Permanently deleted user

    Hello 1106569356,

     

    Thank you for your patience in receiving a reply.

     

    Could you please try the following code example to align the depth and RGB frames?

     

    function align_cust_example()

    % Make Pipeline object to manage streaming

    pipe = realsense.pipeline();

    % Start streaming on an arbitrary camera with default settings

    profile = pipe.start();

    align_to = realsense.stream.color;

    alignedFs = realsense.align(align_to);

    % Get streaming device's name

    dev = profile.get_device();

    name = dev.get_info(realsense.camera_info.name);

    % Get frames. We discard the first couple to allow

    % the camera time to settle

    %while(true)

    for i = 1:5

    fs = pipe.wait_for_frames();

    end

    pipe.stop();

    % Select depth frame

    aligned_frames = alignedFs.process(fs);

    depth = aligned_frames.get_depth_frame();

    %depth = fs.get_depth_frame();

     

    % get depth image parameters

    depthSensor = dev.first('depth_sensor');

    depthScale = depthSensor.get_depth_scale();

    depthWidth = depth.get_width();

    depthHeight = depth.get_height();

    % retrieve UINT16 depth vector

    depthVector = depth.get_data();

    % reshape vector, and scale to depth in meters

    depthMap = double(transpose(reshape(depthVector, [depthWidth,depthHeight]))) .* depthScale;

    %align the depth frames to the color stream

     

    %Select rgb frame

    color = fs.get_color_frame();

    colordata=color.get_data();

    img = permute(reshape(colordata',[3,color.get_width(),color.get_height()]),[3 2 1]);

    subplot(2,1,1);

    imshow(depthMap)

    impixelinfo;

    title('Depth Map (m)');

    subplot(2,1,2);

    imshow(img)

    impixelinfo;

    title('Color Map');

    %end

    % Stop streaming

     

    end

     

    Please be aware that this is an example code. Please feel free to test and modify the code to your specifications.

     

    Best regards,

    Alexandru

    0
    Comment actions Permalink
  • 1106569356

    Hi Alexandru,

    Many thanks for your prompt reply.I am now confused how to extract all the aligned depth and color frame images. I have tried many methods, but still can't solve them. I wonder if you can help me.

    Thank you !

    0
    Comment actions Permalink
  • Eliza Davidov

    Hello 1106569356,

     

    The same as for the other thread, let's continue the conversation on: https://support.intelrealsense.com/hc/en-us/community/posts/360033198613 

     

    Thank you and best regards,

    Eliza

    0
    Comment actions Permalink
  • 1106569356

    Hi Eliza,

    I am sorry that I have raised the same question many times since I urgently need to solve this problem.

    Since I have already recorded a.bag file, now I need to align the color and depth of the record in video and save the aligned sequence image, but it is a little difficult for me.

    Let's discuss it in the other one.https://support.intelrealsense.com/hc/en-us/community/posts/360033198613 

    Thank you.

    0
    Comment actions Permalink

Please sign in to leave a comment.