adopted 2d rendering for vif dataset

This commit is contained in:
Jan Kowalczyk
2024-06-11 11:07:05 +02:00
parent 0ee3bc82b5
commit 7486e110ee
4 changed files with 168 additions and 29 deletions

View File

@@ -1,4 +1,5 @@
from pointcloudset import Dataset
from pointcloudset.io.dataset.ros import dataset_from_ros
from pathlib import Path
from argparse import ArgumentTypeError
from subprocess import run
@@ -7,10 +8,11 @@ from matplotlib.colors import Colormap
from matplotlib import colormaps
def load_dataset_from_bag(bag_file_path: Path, pointcloud_topic: str = "/ouster/points") -> Dataset:
def load_dataset(bag_file_path: Path, pointcloud_topic: str = "/ouster/points") -> Dataset:
return Dataset.from_file(bag_file_path, topic=pointcloud_topic)
def calculate_average_frame_rate(dataset: Dataset):
timestamps = dataset.timestamps
time_deltas = [timestamps[i + 1] - timestamps[i] for i in range(len(timestamps) - 1)]
@@ -32,10 +34,33 @@ def existing_folder(path_string: str) -> Path:
path = Path(path_string)
if not path.exists():
raise ArgumentTypeError(f"{path} does not exist!")
if not path.is_folder():
if not path.is_dir():
raise ArgumentTypeError(f"{path} is not a valid folder!")
return path
def existing_path(path_string: str) -> Path:
path = Path(path_string)
if not path.exists():
raise ArgumentTypeError(f"{path} does not exist!")
return path
def positive_int(number_str: str) -> int:
number_val = int(number_str)
if number_val < 0:
raise ArgumentTypeError(f"{number_val} is not a positive integer!")
return number_val
def angle(angle_str: str) -> float:
angle_val = float(angle_str)
if angle_val < 0 or angle_val >= 360:
raise ArgumentTypeError(f"{angle_val} is not a valid angle! Needs to be in [0, 360)")
return angle_val
def angle_width(angle_str: str) -> float:
angle_val = float(angle_str)
if angle_val < 0 or angle_val > 360:
raise ArgumentTypeError(f"{angle_val} is not a valid angle width! Needs to be in [0, 360]")
return angle_val
def get_colormap_with_special_missing_color(
colormap_name: str, missing_data_color: str = "black", reverse: bool = False