import pandas as pd from alfred.fusion.kitti_fusion import load_pc_from_file from alfred.vis.pointcloud.pointcloud_vis import draw_pcs_open3d from alfred.fusion.common import compute_3d_box_lidar_coords df = pd.read_csv('../data/dbsample3_size3_lr1_batch8_video_result.csv') frame_list = [] for i in range(11001, 13001): dv = df.loc[df['image_idx'] == i].values.tolist() frame_list.append(dv) for i in range(11001, 13001): fileroot = '../data/test_video_filter/0' filename = str(i) filetile = '.bin' filename = fileroot + filename + filetile pcs = load_pc_from_file(filename) pcs = pd.DataFrame(pcs[:, :3]) percentile = pcs[2].quantile(0.00016) pcs = pcs.drop(index=pcs.loc[pcs[2] <= percentile].index).values geometries = [] pcobj = o3d.geometry.PointCloud() pcobj.points = o3d.utility.Vector3dVector(pcs) geometries.append(pcobj) for p in frame_list[i - 11001]: xyz = np.array([p[2:5]]) lwh = np.array([p[5:8]]) r_y = [p[-1]] pts3d = compute_3d_box_lidar_coords(xyz, lwh, angles=r_y,
# software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # from alfred.vis.pointcloud.pointcloud_vis import draw_pcs_open3d import open3d as o3d import numpy as np from alfred.fusion.common import draw_3d_box, compute_3d_box_lidar_coords from alfred.fusion.kitti_fusion import load_pc_from_file import os v_f = os.path.join(os.path.dirname(os.path.abspath(__file__)), './data/000011.bin') pcs = load_pc_from_file(v_f) geometries = [] pcs = np.array(pcs[:, :3]) pcobj = o3d.geometry.PointCloud() pcobj.points = o3d.utility.Vector3dVector(pcs) geometries.append(pcobj) # try getting 3d boxes coordinates res = [[ 4.481686, 5.147319, -1.0229858, 1.5728549, 3.646751, 1.5121397, 1.5486346 ], [ -2.5172017, 5.0262384, -1.0679419, 1.6241353, 4.0445814, 1.4938312, 1.620804 ],
def load_bin(seq_name): file_name = seq_name + ".bin" v_f = os.path.join(os.path.dirname(os.path.abspath(__file__)), "yourfilepath/to/lidar(.bin)", file_name) pcs = load_pc_from_file(v_f) return pcs