Last active
March 15, 2021 12:59
-
-
Save SilvesterHsu/4bdf57250d9b5d95a937e09a74257dcd to your computer and use it in GitHub Desktop.
longshaw dataset example for LiDAR_ground_removal project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pcl | |
import cv2 | |
import numpy as np | |
from module import lidar_projection | |
from module.ground_removal import Processor | |
np.set_printoptions(precision=3, suppress=True) | |
# Load the pcd file | |
''' | |
For kitti dataset: | |
vel_msg = np.asarray(pcl.load('img/kitti_sample.pcd')) | |
vel_msg = vel_msg * np.array([1,1,-1]) # revert the z axis | |
''' | |
# For longshaw dataset: | |
vel_msg = np.asarray(pcl.load('img/***.pcd')) | |
# Segment the ground from the local point cloud | |
''' | |
For kitti dataset: | |
process = Processor(n_segments=70, n_bins=80, line_search_angle=0.3, max_dist_to_line = 0.15, | |
sensor_height=1.73, max_start_height=0.5, long_threshold=8) | |
''' | |
# For longshaw dataset: | |
process = Processor(n_segments=100, n_bins=180, line_search_angle=0.2, max_dist_to_line = 0.25, | |
sensor_height=1.2, max_start_height=5, long_threshold=12) | |
vel_non_ground = process(vel_msg) | |
# Generate BEV image | |
img_raw = lidar_projection.birds_eye_point_cloud(vel_msg, | |
side_range=(-50, 50), fwd_range=(-50, 50), | |
res=0.25, min_height=-2, max_height=4) | |
cv2.imwrite('img/kitti_raw.png', img_raw) | |
img_non_ground = lidar_projection.birds_eye_point_cloud(vel_non_ground, | |
side_range=(-50, 50), fwd_range=(-50, 50), | |
res=0.25, min_height=-2, max_height=4) | |
cv2.imwrite('img/kitti_non_ground.png', img_non_ground) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment