monkeyrom / pointcloud_by_open3D

Intel RealSense camera to capture depth and color frames and converts them into a 3D point cloud using the Open3D library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pointcloud_by_open3D

This code utilizes the Intel RealSense camera to capture depth and color frames and converts them into a 3D point cloud using the Open3D library. The point cloud is then processed to segment planes within the scene using the RANSAC algorithm. The inlier points belonging to the segmented plane are colored red, while the outlier points are retained as a separate point cloud. The code also calculates the oriented bounding box (OBB) of the outlier point cloud, representing the minimum volume 3D box that tightly encloses the points. The OBB's center coordinates and rotation angles (roll, pitch, yaw) are printed to the console. The visualization of the point cloud, segmented planes, and OBB is displayed using the Open3D visualization module.

In the main function, the RealSense pipeline is initialized, and the first set of frames is obtained. The convert_rs_frames_to_pointcloud function converts the frames into a point cloud using the RGBD data. The point cloud is then downsampled using voxel downsampling to reduce the number of points. The segmentation_plane function is applied to the downsampled point cloud, which returns the plane model and inlier indices. The inlier and outlier point clouds are extracted based on the inlier indices. The oriented bounding box (OBB) is computed for the outlier point cloud. The Open3D visualizer is created, and the initial geometries (inlier point cloud, outlier point cloud, and OBB) are added. The visualizer continuously updates the point cloud, inliers, outliers, and OBB based on the incoming frames. The center coordinates and rotation angles of the OBB are calculated and printed to the console. The visualization is updated, and the loop continues until the visualizer window is closed or the pipeline is stopped.

About

Intel RealSense camera to capture depth and color frames and converts them into a 3D point cloud using the Open3D library.

License:BSD 2-Clause "Simplified" License


Languages

Language:Python 100.0%