-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
POINT CLOUD OF A PREDEFINED REGION USING PYREALSENSE2 #2769
Comments
You could manually apply |
Thanks for your response @dorodnic , see my problem is that I have both RGB and depth image aligned. Now from the RGB image I have obtained the x_min, x_max and y_min , y_max for a particular object. Now I want to create a point cloud for that region only using the python wrapper of librealsense. I want to know if that is feasible and how ? |
You could find bounding boxes on the RGB aligned to depth image, use the align = rs.align(rs.stream.depth)
pc = rs.pointcloud()
frames = pipeline.wait_for_frames()
aligned = align.process(frames)
color_aligned_to_depth = aligned.first(rs.stream.color)
xmin, xmax, ymin, ymax = 100, 200, 100, 200 # BB
depth_frame = frames.first(rs.stream.depth)
points = pc.calculate(depth_frame)
w = rs.video_frame(depth_frame).width
h = rs.video_frame(depth_frame).height
verts = np.asanyarray(points.get_vertices()).view(np.float32).reshape(h, w, 3)
roi = verts[ymin:ymax, xmin:xmax, :] |
Hey @ogoshen ,
But the point cloud that I am getting are not having color. Sometimes I get a couple of gree yellow patches but mostly it is white. I am wondering why is it the case. I am sending a couple of ply files for your perusal. it is a scan of a office chair. Link to it https://drive.google.com/drive/folders/1LFSQQDjGnLLDF1JYN6y5iCW-FN_uADZt?usp=sharing |
from open3d import * |
is it a open3d issue or have I made any mistake |
rs code looks fine to me. |
@sunit1409 I'm trying to achieve the same thing, but not able to get a proper cropped point cloud. Can you help me on this? |
how to save the roi into a ".ply" file? |
@bingws Thanks for the code snippet. I solved using open3d.crop_point_cloud for cropping and open3d.write_point_cloud for saving the roi to ".ply" or ".pcd" format |
@arjunskumar your code can be shared to me ? thanks! look here, I have the same problem. |
@bingws I'm not mapping 2D image to 3D Point Clouds. For your case, I was not able to do it, still trying to solve using pyrealsense api |
Hi @sunit1409 , I got the same issue. How did you solved your issue ? help me please |
I understand now! I changed this lines it works ! |
@ogoshen Hi, I want to know is there any difference between vertix and 3D points of the object? Will the vertices more sparse? Thanks a lot! |
When talking about data, they are the same. |
@ogoshen Thanks so much for your quick response to the question from @JimXu1989 :) |
@ogoshen Thanks a lot for your reply! And I want to ask one more question. If I have aRGB image and a depth image, how could I use the two images to get the 3D points? Must I use the frame just captured by my D435i to get the 3D points? |
Depends on how you want to get the data... Basically, you have to call Now, the easiest to visualize the results is to export to ply (using |
Hello, I want to know, if I have some 3D points(in x,y,z), how could I use these 3D points to set up a pc(rs.pointcloud)? and how could I use map_to(frame) to get the uv_map? Thanks a lot! |
Could you tell me, how to generate a rs.points by 3D points in numpy(x,y,z) ? |
If you have external data (like points in an array) that you want to pass through the SDK, you probably have to create a |
I am assuming in this code PointCloud() was from pcl? Is there a good reference for using PCL python binding with intelrealsense. Having trouble install PCL in Mac and using it. |
From the rgb image obtained from realsense I obtain the 2d bounding box of an object. I segment out that region from both rgb and depth image. Now I wish to obtain a point cloud for that region only using pyrealsense2. How can it be done without loosing performance in terms of speed ?
The text was updated successfully, but these errors were encountered: