Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Export Point Clouds (.ply file) Fail #3579

Closed
Ageneinair opened this issue Mar 24, 2019 · 5 comments
Closed

Python Export Point Clouds (.ply file) Fail #3579

Ageneinair opened this issue Mar 24, 2019 · 5 comments
Labels

Comments

@Ageneinair
Copy link

Required Info  
Camera Model D400
Firmware Version 05.10.13.00
Operating System & Version Ubuntu 16.04
Platform PC
SDK Version 2
Language python
Segment Robot

Issue Description

I used the example to generate a .ply file https://github.com/IntelRealSense/librealsense/blob/development/wrappers/python/examples/export_ply_example.py

import pyrealsense2 as rs

pc = rs.pointcloud()
points = rs.points()
pipe = rs.pipeline()
pipe.start();

try:
   
    frames = pipe.wait_for_frames()
    depth = frames.get_depth_frame()
    color = frames.get_color_frame()

    pc.map_to(color)
    points = pc.calculate(depth)

    print("Saving to 1.ply...")
    points.export_to_ply("1.ply", color)
    print("Done")
finally:
    pipe.stop()

Then I use open3D to visualize the point cloud file:

from open3d import *

if __name__ == "__main__":

    print("Load a ply point cloud, print it, and render it")
    pcd = read_point_cloud("1.ply")
    draw_geometries([pcd])

But I only get a bunch of no-meaning points.
image

What should I do now?

@Ageneinair Ageneinair changed the title Export Point Clouds (.ply file) Fail Python Export Point Clouds (.ply file) Fail Mar 24, 2019
@dorodnic
Copy link
Contributor

I think if you zoom into the center of the model, it is Ok. The scale is confused by depth outliers.
You could also filter these out in hardware or software prior to saving using advanced mode controls Depth Clamp or Threshold processing-block.

@Ageneinair
Copy link
Author

I think if you zoom into the center of the model, it is Ok. The scale is confused by depth outliers.
You could also filter these out in hardware or software prior to saving using advanced mode controls Depth Clamp or Threshold processing-block.

Yes, when I zoom into the center, it is ok.
However, when I use the filter following the instruction of here: https://github.com/IntelRealSense/librealsense/blob/jupyter/notebooks/depth_filters.ipynb
The outliers is still existing.
image
My code of filter is the following:

# Filters
decimation = rs.decimation_filter()
decimation.set_option(rs.option.filter_magnitude, 4)
spatial = rs.spatial_filter()
spatial.set_option(rs.option.filter_magnitude, 5)
spatial.set_option(rs.option.filter_smooth_alpha, 1)
spatial.set_option(rs.option.filter_smooth_delta, 50)
spatial.set_option(rs.option.holes_fill, 3)
temporal = rs.temporal_filter()
hole_filling = rs.hole_filling_filter()
depth_to_disparity = rs.disparity_transform(True)
disparity_to_depth = rs.disparity_transform(False)

for x in range(10):
    depth_frame = frames[x]
    depth_frame = decimation.process(depth_frame)
    depth_frame = depth_to_disparity.process(depth_frame)
    depth_frame = spatial.process(depth_frame)
    depth_frame = temporal.process(depth_frame)
    depth_frame = disparity_to_depth.process(depth_frame)
    depth_frame = hole_filling.process(depth_frame)

How can I delete these outliers?

@RealSenseCustomerSupport
Copy link
Collaborator


Hi @Ageneinair,

You can try to use the advanced control "depth clamp" (depthClampMax and depthClampMin) to see how it works.

@RealSenseCustomerSupport
Copy link
Collaborator


Is the issue resolved?

@Steven-ZY
Copy link

@Ageneinair would be helpful if you mention how you solved the above mentioned issue as we face a similar one from time to time on some of our robots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants