|
16 | 16 | class RosbagProcessor(): |
17 | 17 | # Pairs up and stores Image and PointCloud2 messages into their respective test (20%) and training (80%) png and bin files. |
18 | 18 | def __init__(self, DATA_DIR: str, train_counter: int = 0, test_counter: int = 0) -> None: |
19 | | - |
20 | | - self.__TEST_DIR = DATA_DIR / 'test' |
21 | | - self.__TRAIN_DIR = DATA_DIR / 'train' |
22 | | - TEST_IMG_DIR = self.__TEST_DIR / 'img' |
23 | | - TEST_BIN_DIR = self.__TEST_DIR / 'bin' |
24 | | - TRAIN_IMG_DIR = self.__TRAIN_DIR / 'img' |
25 | | - TRAIN_BIN_DIR = self.__TRAIN_DIR / 'bin' |
| 19 | + self.__img_folder = 'image_2' |
| 20 | + self.__lidar_folder = 'velodyne' |
| 21 | + |
| 22 | + self.__TEST_DIR = DATA_DIR / 'testing' |
| 23 | + self.__TRAIN_DIR = DATA_DIR / 'training' |
| 24 | + TEST_IMG_DIR = self.__TEST_DIR / self.__img_folder |
| 25 | + TEST_BIN_DIR = self.__TEST_DIR / self.__lidar_folder |
| 26 | + TRAIN_IMG_DIR = self.__TRAIN_DIR / self.__img_folder |
| 27 | + TRAIN_BIN_DIR = self.__TRAIN_DIR / self.__lidar_folder |
26 | 28 |
|
27 | 29 | # Create directories if they don't exist |
28 | 30 | TEST_IMG_DIR.mkdir(parents=True, exist_ok=True) |
@@ -53,8 +55,8 @@ def pair_data_callback(self, rgb_image_msg: Image, lidar_pc2_msg: PointCloud2): |
53 | 55 | idx = self.__train_counter |
54 | 56 |
|
55 | 57 | # Store point cloud and image data with KITTI formatted filenames: |
56 | | - image_filename = PARENT_FOLDER / 'img' / f"{idx:06d}.png" |
57 | | - pc_filename = PARENT_FOLDER / 'bin' / f"{idx:06d}.bin" |
| 58 | + image_filename = PARENT_FOLDER / self.__img_folder / f"{idx:06d}.png" |
| 59 | + pc_filename = PARENT_FOLDER / self.__lidar_folder / f"{idx:06d}.bin" |
58 | 60 | # image_filename = self.get_path(image_filename) |
59 | 61 | # pc_filename = self.get_path(pc_filename) |
60 | 62 |
|
@@ -97,4 +99,5 @@ def pair_data_callback(self, rgb_image_msg: Image, lidar_pc2_msg: PointCloud2): |
97 | 99 |
|
98 | 100 | # Path to the destination folder (relative from this script) |
99 | 101 | DATA_DIR = BASE_DIR.parent.parent.parent.parent / 'data' / 'sensorFusionData' |
| 102 | + DATA_DIR.mkdir(parents=True, exist_ok=True) |
100 | 103 | bag_processor = RosbagProcessor(DATA_DIR=DATA_DIR) |
0 commit comments