From 6151a918b0c885e3f19d8501b28dc855249d034e Mon Sep 17 00:00:00 2001 From: ch-sa Date: Sun, 9 Jan 2022 20:24:07 +0100 Subject: [PATCH] General cleanup - fix spelling - change ressource to resource - use pathlib to handle paths and files - point cloud loading and label handling - adapt paths in tests - bump version --- .gitignore | 4 + labelCloud/__init__.py | 2 +- labelCloud/__main__.py | 6 +- labelCloud/control/config_manager.py | 22 ++- labelCloud/control/label_manager.py | 25 ++-- labelCloud/control/pcd_manager.py | 84 +++++------ labelCloud/label_formats/base.py | 31 ++-- labelCloud/label_formats/centroid_format.py | 27 ++-- labelCloud/label_formats/kitti_format.py | 25 ++-- labelCloud/label_formats/vertices_format.py | 24 +-- labelCloud/model/point_cloud.py | 3 +- .../{ressources => resources}/__init__.py | 0 .../default_config.ini | 0 .../examples/__init__.py | 0 .../examples/exemplary.json | 0 .../examples/exemplary.ply | Bin .../icons/ICON_LICENSES.txt | 0 .../icons/__init__.py | 0 .../icons/arrow-down-bold.svg | 0 .../icons/arrow-left-bold.svg | 0 .../icons/arrow-right-bold.svg | 0 .../icons/arrow-up-bold.svg | 0 .../icons/content-save-outline.svg | 0 .../icons/cube-outline.svg | 0 .../icons/cube-outline_white.svg | 0 .../icons/cursor-default-click.svg | 0 .../icons/delete-outline.svg | 0 .../icons/download.svg | 0 .../icons/labelCloud.ico | Bin .../icons/labelCloud_icon.png | Bin .../icons/minus-box-multiple-outline.svg | 0 .../icons/panorama.svg | 0 .../icons/plus-box-multiple-outline.svg | 0 .../icons/resize.svg | 0 .../icons/select-off.svg | 0 .../icons/upload.svg | 0 .../interfaces/__init__.py | 0 .../interfaces/interface.ui | 0 .../interfaces/settings_interface.ui | 0 .../labelCloud_icon.pcd | Bin .../rocket-palette.txt | 0 labelCloud/tests/unit/conftest.py | 8 + labelCloud/tests/unit/test_label_export.py | 138 +++++++++--------- labelCloud/tests/unit/test_label_import.py | 25 ++-- labelCloud/view/gui.py | 18 +-- labelCloud/view/settings_dialog.py | 2 +- labelCloud/view/viewer.py | 6 +- labels/exemplary.json | 14 +- setup.cfg | 16 +- 49 files changed, 243 insertions(+), 237 deletions(-) rename labelCloud/{ressources => resources}/__init__.py (100%) rename labelCloud/{ressources => resources}/default_config.ini (100%) rename labelCloud/{ressources => resources}/examples/__init__.py (100%) rename labelCloud/{ressources => resources}/examples/exemplary.json (100%) rename labelCloud/{ressources => resources}/examples/exemplary.ply (100%) rename labelCloud/{ressources => resources}/icons/ICON_LICENSES.txt (100%) rename labelCloud/{ressources => resources}/icons/__init__.py (100%) rename labelCloud/{ressources => resources}/icons/arrow-down-bold.svg (100%) rename labelCloud/{ressources => resources}/icons/arrow-left-bold.svg (100%) rename labelCloud/{ressources => resources}/icons/arrow-right-bold.svg (100%) rename labelCloud/{ressources => resources}/icons/arrow-up-bold.svg (100%) rename labelCloud/{ressources => resources}/icons/content-save-outline.svg (100%) rename labelCloud/{ressources => resources}/icons/cube-outline.svg (100%) rename labelCloud/{ressources => resources}/icons/cube-outline_white.svg (100%) rename labelCloud/{ressources => resources}/icons/cursor-default-click.svg (100%) rename labelCloud/{ressources => resources}/icons/delete-outline.svg (100%) rename labelCloud/{ressources => resources}/icons/download.svg (100%) rename labelCloud/{ressources => resources}/icons/labelCloud.ico (100%) rename labelCloud/{ressources => resources}/icons/labelCloud_icon.png (100%) rename labelCloud/{ressources => resources}/icons/minus-box-multiple-outline.svg (100%) rename labelCloud/{ressources => resources}/icons/panorama.svg (100%) rename labelCloud/{ressources => resources}/icons/plus-box-multiple-outline.svg (100%) rename labelCloud/{ressources => resources}/icons/resize.svg (100%) rename labelCloud/{ressources => resources}/icons/select-off.svg (100%) rename labelCloud/{ressources => resources}/icons/upload.svg (100%) rename labelCloud/{ressources => resources}/interfaces/__init__.py (100%) rename labelCloud/{ressources => resources}/interfaces/interface.ui (100%) rename labelCloud/{ressources => resources}/interfaces/settings_interface.ui (100%) rename labelCloud/{ressources => resources}/labelCloud_icon.pcd (100%) rename labelCloud/{ressources => resources}/rocket-palette.txt (100%) diff --git a/.gitignore b/.gitignore index f4bdf60..5a4c7bb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ *.qt_for_python .idea +!labelCloud/resources/examples/exemplary.ply +!labelCloud/resources/examples/exemplary.json +!labelCloud/resources/labelCloud_icon.pcd + # ---------------------------------------------------------------------------- # # GENERATED # # ---------------------------------------------------------------------------- # diff --git a/labelCloud/__init__.py b/labelCloud/__init__.py index 5c2c6c5..54149df 100644 --- a/labelCloud/__init__.py +++ b/labelCloud/__init__.py @@ -1 +1 @@ -__version__ = "0.6.9" +__version__ = "0.6.10" diff --git a/labelCloud/__main__.py b/labelCloud/__main__.py index 1470bd3..40f16e6 100644 --- a/labelCloud/__main__.py +++ b/labelCloud/__main__.py @@ -46,18 +46,18 @@ def setup_example_project() -> None: # Copy example files shutil.copy( - pkg_resources.resource_filename("labelCloud.ressources", "default_config.ini"), + pkg_resources.resource_filename("labelCloud.resources", "default_config.ini"), str(cwdir.joinpath("config.ini")), ) shutil.copy( pkg_resources.resource_filename( - "labelCloud.ressources.examples", "exemplary.ply" + "labelCloud.resources.examples", "exemplary.ply" ), str(pcd_folder.joinpath("exemplary.ply")), ) shutil.copy( pkg_resources.resource_filename( - "labelCloud.ressources.examples", "exemplary.json" + "labelCloud.resources.examples", "exemplary.json" ), str(label_folder.joinpath("exemplary.json")), ) diff --git a/labelCloud/control/config_manager.py b/labelCloud/control/config_manager.py index fa5d7ca..ee57d16 100644 --- a/labelCloud/control/config_manager.py +++ b/labelCloud/control/config_manager.py @@ -1,7 +1,7 @@ """Load configuration from .ini file.""" import configparser -import os -from typing import List +from pathlib import Path +from typing import List, Union import pkg_resources @@ -12,7 +12,9 @@ class ExtendedConfigParser(configparser.ConfigParser): Can automatically parse float values besides plain strings. """ - def getlist(self, section, option, raw=False, vars=None, fallback=None) -> List: + def getlist( + self, section, option, raw=False, vars=None, fallback=None + ) -> List[Union[str, float]]: raw_value = self.get(section, option, raw=raw, vars=vars, fallback=fallback) if "," in raw_value: values = [x.strip() for x in raw_value.split(",")] @@ -22,11 +24,15 @@ def getlist(self, section, option, raw=False, vars=None, fallback=None) -> List: return values return raw_value + def getpath(self, section, option, raw=False, vars=None, fallback=None) -> Path: + """Get a path from the configuration file.""" + return Path(self.get(section, option, raw=raw, vars=vars, fallback=fallback)) + class ConfigManager(object): - PATH_TO_CONFIG = "config.ini" # TODO: Handle! - PATH_TO_DEFAULT_CONFIG = pkg_resources.resource_filename( - "labelCloud.ressources", "default_config.ini" + PATH_TO_CONFIG = Path.cwd().joinpath("config.ini") + PATH_TO_DEFAULT_CONFIG = Path( + pkg_resources.resource_filename("labelCloud.resources", "default_config.ini") ) def __init__(self) -> None: @@ -34,13 +40,13 @@ def __init__(self) -> None: self.read_from_file() def read_from_file(self) -> None: - if os.path.isfile(ConfigManager.PATH_TO_CONFIG): + if ConfigManager.PATH_TO_CONFIG.is_file(): self.config.read(ConfigManager.PATH_TO_CONFIG) else: self.config.read(ConfigManager.PATH_TO_DEFAULT_CONFIG) def write_into_file(self) -> None: - with open(ConfigManager.PATH_TO_CONFIG, "w") as configfile: + with ConfigManager.PATH_TO_CONFIG.open("w") as configfile: self.config.write(configfile, space_around_delimiters=True) def reset_to_default(self) -> None: diff --git a/labelCloud/control/label_manager.py b/labelCloud/control/label_manager.py index f836eb4..4fb72f0 100644 --- a/labelCloud/control/label_manager.py +++ b/labelCloud/control/label_manager.py @@ -1,5 +1,4 @@ -import ntpath -import os +from pathlib import Path from typing import List from ..label_formats import BaseLabelFormat, CentroidFormat, KittiFormat, VerticesFormat @@ -7,7 +6,7 @@ from .config_manager import config -def get_label_strategy(export_format: str, label_folder: str) -> "BaseLabelFormat": +def get_label_strategy(export_format: str, label_folder: Path) -> "BaseLabelFormat": if export_format == "vertices": return VerticesFormat(label_folder, LabelManager.EXPORT_PRECISION) elif export_format == "centroid_rel": @@ -45,17 +44,19 @@ class LabelManager(object): EXPORT_PRECISION = config.getint("LABEL", "export_precision") def __init__( - self, strategy: str = STD_LABEL_FORMAT, path_to_label_folder: str = None + self, strategy: str = STD_LABEL_FORMAT, path_to_label_folder: Path = None ) -> None: - self.label_folder = path_to_label_folder or config.get("FILE", "label_folder") - if not os.path.isdir(self.label_folder): - os.mkdir(self.label_folder) + self.label_folder = path_to_label_folder or config.getpath( + "FILE", "label_folder" + ) + if not self.label_folder.is_dir(): + self.label_folder.mkdir(parents=True) self.label_strategy = get_label_strategy(strategy, self.label_folder) - def import_labels(self, pcd_name: str) -> List[BBox]: + def import_labels(self, pcd_path: Path) -> List[BBox]: try: - return self.label_strategy.import_labels(os.path.splitext(pcd_name)[0]) + return self.label_strategy.import_labels(pcd_path) except KeyError as key_error: print("Found a key error with %s in the dictionary." % key_error) print( @@ -69,7 +70,5 @@ def import_labels(self, pcd_name: str) -> List[BBox]: ) return [] - def export_labels(self, pcd_path: str, bboxes: List[BBox]) -> None: - pcd_name = ntpath.basename(pcd_path) - pcd_folder = os.path.dirname(pcd_path) - self.label_strategy.export_labels(bboxes, pcd_name, pcd_folder, pcd_path) + def export_labels(self, pcd_path: Path, bboxes: List[BBox]) -> None: + self.label_strategy.export_labels(bboxes, pcd_path) diff --git a/labelCloud/control/pcd_manager.py b/labelCloud/control/pcd_manager.py index 0e14c06..4322979 100644 --- a/labelCloud/control/pcd_manager.py +++ b/labelCloud/control/pcd_manager.py @@ -2,9 +2,8 @@ Module to manage the point clouds (loading, navigation, floor alignment). Sets the point cloud and original point cloud path. Initiate the writing to the virtual object buffer. """ -import ntpath -import os from dataclasses import dataclass +from pathlib import Path from shutil import copyfile from typing import TYPE_CHECKING, List, Optional, Tuple @@ -29,7 +28,7 @@ class Perspective(object): def color_pointcloud(points, z_min, z_max) -> np.ndarray: palette = np.loadtxt( - pkg_resources.resource_filename("labelCloud.ressources", "rocket-palette.txt") + pkg_resources.resource_filename("labelCloud.resources", "rocket-palette.txt") ) palette_len = len(palette) - 1 @@ -48,8 +47,8 @@ class PointCloudManger(object): def __init__(self) -> None: # Point cloud management - self.pcd_folder = config.get("FILE", "pointcloud_folder") - self.pcds = [] + self.pcd_folder = config.getpath("FILE", "pointcloud_folder") + self.pcds: List[Path] = [] self.current_id = -1 self.current_o3d_pcd = None @@ -61,12 +60,21 @@ def __init__(self) -> None: self.collected_object_classes = set() self.saved_perspective: Perspective = None + @property + def pcd_path(self) -> Path: + return self.pcds[self.current_id] + + @property + def pcd_name(self) -> Optional[str]: + if self.current_id >= 0: + return self.pcd_path.name + def read_pointcloud_folder(self) -> None: """Checks point cloud folder and sets self.pcds to all valid point cloud file names.""" - if os.path.isdir(self.pcd_folder): + if self.pcd_folder.is_dir(): self.pcds = [] - for file in sorted(os.listdir(self.pcd_folder), key=str.casefold): - if file.endswith(tuple(PointCloudManger.PCD_EXTENSIONS)): + for file in sorted(self.pcd_folder.iterdir()): + if file.suffix in PointCloudManger.PCD_EXTENSIONS: self.pcds.append(file) else: print(f"Point cloud path {self.pcd_folder} is not a valid directory.") @@ -85,7 +93,7 @@ def read_pointcloud_folder(self) -> None: ) self.pointcloud = self.load_pointcloud( pkg_resources.resource_filename( - "labelCloud.ressources", "labelCloud_icon.pcd" + "labelCloud.resources", "labelCloud_icon.pcd" ) ) self.update_pcd_infos(pointcloud_label=" – (select folder!)") @@ -101,7 +109,7 @@ def get_next_pcd(self) -> None: print("Loading next point cloud...") if self.pcds_left(): self.current_id += 1 - self.pointcloud = self.load_pointcloud(self.get_current_path()) + self.pointcloud = self.load_pointcloud(self.pcd_path) self.update_pcd_infos() else: print("No point clouds left!") @@ -110,27 +118,13 @@ def get_prev_pcd(self) -> None: print("Loading previous point cloud...") if self.current_id > 0: self.current_id -= 1 - self.pointcloud = self.load_pointcloud(self.get_current_path()) + self.pointcloud = self.load_pointcloud(self.pcd_path) self.update_pcd_infos() else: raise Exception("No point cloud left for loading!") - def get_pointcloud(self) -> PointCloud: - return self.pointcloud - - def get_current_name(self) -> str: - if self.current_id >= 0: - return self.pcds[self.current_id] - - def get_current_details(self) -> Tuple[str, int, int]: - if self.current_id >= 0: - return self.get_current_name(), self.current_id + 1, len(self.pcds) - - def get_current_path(self) -> str: - return os.path.join(self.pcd_folder, self.pcds[self.current_id]) - def get_labels_from_file(self) -> List[BBox]: - bboxes = self.label_manager.import_labels(self.get_current_name()) + bboxes = self.label_manager.import_labels(self.pcd_path) print("Loaded %s bboxes!" % len(bboxes)) return bboxes @@ -141,7 +135,7 @@ def set_view(self, view: "GUI") -> None: def save_labels_into_file(self, bboxes: List[BBox]) -> None: if self.pcds: - self.label_manager.export_labels(self.get_current_path(), bboxes) + self.label_manager.export_labels(self.pcd_path, bboxes) self.collected_object_classes.update( {bbox.get_classname() for bbox in bboxes} ) @@ -162,15 +156,13 @@ def save_current_perspective(self, active: bool = True) -> None: print("Reset saved perspective.") # MANIPULATOR - def load_pointcloud(self, path_to_pointcloud: str) -> PointCloud: - print("=" * 20, "Loading", ntpath.basename(path_to_pointcloud), "=" * 20) + def load_pointcloud(self, path_to_pointcloud: Path) -> PointCloud: + print("=" * 20, "Loading", path_to_pointcloud.name, "=" * 20) if config.getboolean("USER_INTERFACE", "keep_perspective"): self.save_current_perspective() - if ( - os.path.splitext(path_to_pointcloud)[1] == ".bin" - ): # Loading binary pcds with numpy + if path_to_pointcloud.suffix == ".bin": # Loading binary pcds with numpy bin_pcd = np.fromfile(path_to_pointcloud, dtype=np.float32) points = bin_pcd.reshape((-1, 4))[ :, 0:3 @@ -178,10 +170,8 @@ def load_pointcloud(self, path_to_pointcloud: str) -> PointCloud: self.current_o3d_pcd = o3d.geometry.PointCloud( o3d.utility.Vector3dVector(points) ) - else: - self.current_o3d_pcd = o3d.io.read_point_cloud( - path_to_pointcloud - ) # Load point cloud with open3d + else: # Load point cloud with open3d + self.current_o3d_pcd = o3d.io.read_point_cloud(str(path_to_pointcloud)) tmp_pcd = PointCloud(path_to_pointcloud) tmp_pcd.points = np.asarray(self.current_o3d_pcd.points).astype( @@ -271,15 +261,13 @@ def rotate_pointcloud( self, axis: List[float], angle: float, rotation_point: List[float] ) -> None: # Save current, original point cloud in ORIGINALS_FOLDER - originals_path = os.path.join( - self.pcd_folder, PointCloudManger.ORIGINALS_FOLDER - ) - if not os.path.exists(originals_path): - os.mkdir(originals_path) + originals_path = self.pcd_folder.joinpath(PointCloudManger.ORIGINALS_FOLDER) + originals_path.mkdir(parents=True, exist_ok=True) copyfile( - self.get_current_path(), - os.path.join(originals_path, self.get_current_name()), + str(self.pcd_path), + str(originals_path.joinpath(self.pcd_name)), ) + # Rotate and translate point cloud rotation_matrix = o3d.geometry.get_rotation_matrix_from_axis_angle( np.multiply(axis, angle) @@ -298,11 +286,11 @@ def rotate_pointcloud( center=(0, 0, 0), ) - save_path = self.get_current_path() - if os.path.splitext(save_path)[1] == ".bin": - save_path = save_path[:-4] + ".pcd" + save_path = self.pcd_path + if save_path.suffix == ".bin": # save .bin point clouds as .pcd + save_path = save_path.parent.joinpath(save_path.stem + ".pcd") - o3d.io.write_point_cloud(save_path, self.current_o3d_pcd) + o3d.io.write_point_cloud(str(save_path), self.current_o3d_pcd) self.pointcloud = self.load_pointcloud(save_path) # HELPER @@ -323,7 +311,7 @@ def get_perspective(self) -> Tuple[float, float, float]: # UPDATE GUI def update_pcd_infos(self, pointcloud_label: str = None) -> None: - self.view.set_pcd_label(pointcloud_label or self.get_current_name()) + self.view.set_pcd_label(pointcloud_label or self.pcd_name) self.view.update_progress(self.current_id) if self.current_id <= 0: diff --git a/labelCloud/label_formats/base.py b/labelCloud/label_formats/base.py index a7c77c6..cb90a0f 100644 --- a/labelCloud/label_formats/base.py +++ b/labelCloud/label_formats/base.py @@ -1,6 +1,6 @@ import json -import os from abc import ABC, abstractmethod +from pathlib import Path from typing import List, Optional, Union import numpy as np @@ -11,7 +11,9 @@ class BaseLabelFormat(ABC): FILE_ENDING = ".json" - def __init__(self, label_folder, export_precision, relative_rotation=False) -> None: + def __init__( + self, label_folder: Path, export_precision: int, relative_rotation: bool = False + ) -> None: self.label_folder = label_folder print("Set export strategy to %s." % self.__class__.__name__) self.export_precision = export_precision @@ -26,35 +28,34 @@ def __init__(self, label_folder, export_precision, relative_rotation=False) -> N else: print("Saving rotations absolutely to positve x-axis in degrees (0..360°).") - def update_label_folder(self, new_label_folder) -> None: + def update_label_folder(self, new_label_folder: Path) -> None: self.label_folder = new_label_folder + print(f"Updated label folder to {new_label_folder}.") def round_dec(self, x, decimal_places: Optional[int] = None) -> List[float]: if not decimal_places: decimal_places = self.export_precision return np.round(x, decimal_places).tolist() - def save_label_to_file(self, pcd_name: str, data: Union[dict, str]) -> str: - path_to_file = os.path.join( - self.label_folder, os.path.splitext(pcd_name)[0] + self.FILE_ENDING - ) + def save_label_to_file(self, pcd_path: Path, data: Union[dict, str]) -> Path: + label_path = self.label_folder.joinpath(pcd_path.stem + self.FILE_ENDING) - if os.path.isfile(path_to_file): - print("File %s already exists, replacing file ..." % path_to_file) - if os.path.splitext(path_to_file)[1] == ".json": - with open(path_to_file, "w") as write_file: + if label_path.is_file(): + print("File %s already exists, replacing file ..." % label_path) + if label_path.suffix == ".json": + with open(label_path, "w") as write_file: json.dump(data, write_file, indent="\t") else: - with open(path_to_file, "w") as write_file: + with open(label_path, "w") as write_file: write_file.write(data) - return path_to_file + return label_path @abstractmethod - def import_labels(self, pcd_name_stripped) -> List[BBox]: + def import_labels(self, pcd_path: Path) -> List[BBox]: raise NotImplementedError @abstractmethod - def export_labels(self, bboxes, pcd_name, pcd_folder, pcd_path) -> None: + def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None: raise NotImplementedError diff --git a/labelCloud/label_formats/centroid_format.py b/labelCloud/label_formats/centroid_format.py index 4f11f40..e6f5fcc 100644 --- a/labelCloud/label_formats/centroid_format.py +++ b/labelCloud/label_formats/centroid_format.py @@ -1,5 +1,5 @@ import json -import os +from pathlib import Path from typing import List from ..model import BBox @@ -9,11 +9,12 @@ class CentroidFormat(BaseLabelFormat): FILE_ENDING = ".json" - def import_labels(self, pcd_name_stripped) -> List[BBox]: + def import_labels(self, pcd_path: Path) -> List[BBox]: labels = [] - path_to_label = os.path.join(self.label_folder, pcd_name_stripped + ".json") - if os.path.isfile(path_to_label): - with open(path_to_label, "r") as read_file: + + label_path = self.label_folder.joinpath(pcd_path.stem + self.FILE_ENDING) + if label_path.is_file(): + with label_path.open("r") as read_file: data = json.load(read_file) for label in data["objects"]: @@ -24,17 +25,15 @@ def import_labels(self, pcd_name_stripped) -> List[BBox]: bbox.set_rotations(*rotations) bbox.set_classname(label["name"]) labels.append(bbox) - print("Imported %s labels from %s." % (len(data["objects"]), path_to_label)) + print("Imported %s labels from %s." % (len(data["objects"]), label_path)) return labels - def export_labels( - self, bboxes: List[BBox], pcd_name: str, pcd_folder: str, pcd_path: str - ) -> None: + def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None: data = dict() # Header - data["folder"] = pcd_folder - data["filename"] = pcd_name - data["path"] = pcd_path + data["folder"] = pcd_path.parent.name + data["filename"] = pcd_path.name + data["path"] = str(pcd_path) # Labels data["objects"] = [] @@ -62,8 +61,8 @@ def export_labels( data["objects"].append(label) # Save to JSON - path_to_file = self.save_label_to_file(pcd_name, data) + label_path = self.save_label_to_file(pcd_path, data) print( - f"Exported {len(bboxes)} labels to {path_to_file} " + f"Exported {len(bboxes)} labels to {label_path} " f"in {self.__class__.__name__} formatting!" ) diff --git a/labelCloud/label_formats/kitti_format.py b/labelCloud/label_formats/kitti_format.py index fefae2f..b520d40 100644 --- a/labelCloud/label_formats/kitti_format.py +++ b/labelCloud/label_formats/kitti_format.py @@ -1,5 +1,5 @@ import math -import os +from pathlib import Path from typing import List from ..model import BBox @@ -10,16 +10,21 @@ class KittiFormat(BaseLabelFormat): FILE_ENDING = ".txt" def __init__( - self, label_folder, export_precision, relative_rotation=False, transformed=True + self, + label_folder: Path, + export_precision: int, + relative_rotation: bool = False, + transformed: bool = True, ) -> None: super().__init__(label_folder, export_precision, relative_rotation) self.transformed = transformed - def import_labels(self, pcd_name_stripped) -> List[BBox]: + def import_labels(self, pcd_path: Path) -> List[BBox]: labels = [] - path_to_label = os.path.join(self.label_folder, pcd_name_stripped + ".txt") - if os.path.isfile(path_to_label): - with open(path_to_label, "r") as read_file: + + label_path = self.label_folder.joinpath(pcd_path.stem + self.FILE_ENDING) + if label_path.is_file(): + with label_path.open("r") as read_file: label_lines = read_file.readlines() for line in label_lines: @@ -39,12 +44,10 @@ def import_labels(self, pcd_name_stripped) -> List[BBox]: bbox.set_rotations(0, 0, rel2abs_rotation(float(line_elements[14]))) bbox.set_classname(line_elements[0]) labels.append(bbox) - print("Imported %s labels from %s." % (len(label_lines), path_to_label)) + print("Imported %s labels from %s." % (len(label_lines), label_path)) return labels - def export_labels( - self, bboxes: List[BBox], pcd_name: str, pcd_folder: str, pcd_path: str - ) -> None: + def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None: data = str() # Labels @@ -74,7 +77,7 @@ def export_labels( ) # Save to TXT - path_to_file = self.save_label_to_file(pcd_name, data) + path_to_file = self.save_label_to_file(pcd_path, data) print( f"Exported {len(bboxes)} labels to {path_to_file} " f"in {self.__class__.__name__} formatting!" diff --git a/labelCloud/label_formats/vertices_format.py b/labelCloud/label_formats/vertices_format.py index c2e156c..067f387 100644 --- a/labelCloud/label_formats/vertices_format.py +++ b/labelCloud/label_formats/vertices_format.py @@ -1,5 +1,5 @@ import json -import os +from pathlib import Path from typing import List import numpy as np @@ -12,12 +12,12 @@ class VerticesFormat(BaseLabelFormat): FILE_ENDING = ".json" - def import_labels(self, pcd_name_stripped) -> List[BBox]: + def import_labels(self, pcd_path: Path) -> List[BBox]: labels = [] - path_to_label = os.path.join(self.label_folder, pcd_name_stripped + ".json") - if os.path.isfile(path_to_label): - with open(path_to_label, "r") as read_file: + label_path = self.label_folder.joinpath(pcd_path.stem + self.FILE_ENDING) + if label_path.is_file(): + with label_path.open("r") as read_file: data = json.load(read_file) for label in data["objects"]: @@ -40,15 +40,15 @@ def import_labels(self, pcd_name_stripped) -> List[BBox]: bbox.set_rotations(*rotations) bbox.set_classname(label["name"]) labels.append(bbox) - print("Imported %s labels from %s." % (len(data["objects"]), path_to_label)) + print("Imported %s labels from %s." % (len(data["objects"]), label_path)) return labels - def export_labels(self, bboxes, pcd_name, pcd_folder, pcd_path) -> None: + def export_labels(self, bboxes: List[BBox], pcd_path: Path) -> None: data = dict() # Header - data["folder"] = pcd_folder - data["filename"] = pcd_name - data["path"] = pcd_path + data["folder"] = pcd_path.parent.name + data["filename"] = pcd_path.name + data["path"] = str(pcd_path) # Labels data["objects"] = [] @@ -61,8 +61,8 @@ def export_labels(self, bboxes, pcd_name, pcd_folder, pcd_path) -> None: data["objects"].append(label) # Save to JSON - path_to_file = self.save_label_to_file(pcd_name, data) + label_path = self.save_label_to_file(pcd_path, data) print( - f"Exported {len(bboxes)} labels to {path_to_file} " + f"Exported {len(bboxes)} labels to {label_path} " f"in {self.__class__.__name__} formatting!" ) diff --git a/labelCloud/model/point_cloud.py b/labelCloud/model/point_cloud.py index 7cf4857..fb8f12e 100644 --- a/labelCloud/model/point_cloud.py +++ b/labelCloud/model/point_cloud.py @@ -1,4 +1,5 @@ import ctypes +from pathlib import Path from typing import List, Tuple import numpy as np @@ -23,7 +24,7 @@ def create_buffer(attributes) -> GL.glGenBuffers: class PointCloud(object): - def __init__(self, path) -> None: + def __init__(self, path: Path) -> None: self.path_to_pointcloud = path self.points = None self.colors = None diff --git a/labelCloud/ressources/__init__.py b/labelCloud/resources/__init__.py similarity index 100% rename from labelCloud/ressources/__init__.py rename to labelCloud/resources/__init__.py diff --git a/labelCloud/ressources/default_config.ini b/labelCloud/resources/default_config.ini similarity index 100% rename from labelCloud/ressources/default_config.ini rename to labelCloud/resources/default_config.ini diff --git a/labelCloud/ressources/examples/__init__.py b/labelCloud/resources/examples/__init__.py similarity index 100% rename from labelCloud/ressources/examples/__init__.py rename to labelCloud/resources/examples/__init__.py diff --git a/labelCloud/ressources/examples/exemplary.json b/labelCloud/resources/examples/exemplary.json similarity index 100% rename from labelCloud/ressources/examples/exemplary.json rename to labelCloud/resources/examples/exemplary.json diff --git a/labelCloud/ressources/examples/exemplary.ply b/labelCloud/resources/examples/exemplary.ply similarity index 100% rename from labelCloud/ressources/examples/exemplary.ply rename to labelCloud/resources/examples/exemplary.ply diff --git a/labelCloud/ressources/icons/ICON_LICENSES.txt b/labelCloud/resources/icons/ICON_LICENSES.txt similarity index 100% rename from labelCloud/ressources/icons/ICON_LICENSES.txt rename to labelCloud/resources/icons/ICON_LICENSES.txt diff --git a/labelCloud/ressources/icons/__init__.py b/labelCloud/resources/icons/__init__.py similarity index 100% rename from labelCloud/ressources/icons/__init__.py rename to labelCloud/resources/icons/__init__.py diff --git a/labelCloud/ressources/icons/arrow-down-bold.svg b/labelCloud/resources/icons/arrow-down-bold.svg similarity index 100% rename from labelCloud/ressources/icons/arrow-down-bold.svg rename to labelCloud/resources/icons/arrow-down-bold.svg diff --git a/labelCloud/ressources/icons/arrow-left-bold.svg b/labelCloud/resources/icons/arrow-left-bold.svg similarity index 100% rename from labelCloud/ressources/icons/arrow-left-bold.svg rename to labelCloud/resources/icons/arrow-left-bold.svg diff --git a/labelCloud/ressources/icons/arrow-right-bold.svg b/labelCloud/resources/icons/arrow-right-bold.svg similarity index 100% rename from labelCloud/ressources/icons/arrow-right-bold.svg rename to labelCloud/resources/icons/arrow-right-bold.svg diff --git a/labelCloud/ressources/icons/arrow-up-bold.svg b/labelCloud/resources/icons/arrow-up-bold.svg similarity index 100% rename from labelCloud/ressources/icons/arrow-up-bold.svg rename to labelCloud/resources/icons/arrow-up-bold.svg diff --git a/labelCloud/ressources/icons/content-save-outline.svg b/labelCloud/resources/icons/content-save-outline.svg similarity index 100% rename from labelCloud/ressources/icons/content-save-outline.svg rename to labelCloud/resources/icons/content-save-outline.svg diff --git a/labelCloud/ressources/icons/cube-outline.svg b/labelCloud/resources/icons/cube-outline.svg similarity index 100% rename from labelCloud/ressources/icons/cube-outline.svg rename to labelCloud/resources/icons/cube-outline.svg diff --git a/labelCloud/ressources/icons/cube-outline_white.svg b/labelCloud/resources/icons/cube-outline_white.svg similarity index 100% rename from labelCloud/ressources/icons/cube-outline_white.svg rename to labelCloud/resources/icons/cube-outline_white.svg diff --git a/labelCloud/ressources/icons/cursor-default-click.svg b/labelCloud/resources/icons/cursor-default-click.svg similarity index 100% rename from labelCloud/ressources/icons/cursor-default-click.svg rename to labelCloud/resources/icons/cursor-default-click.svg diff --git a/labelCloud/ressources/icons/delete-outline.svg b/labelCloud/resources/icons/delete-outline.svg similarity index 100% rename from labelCloud/ressources/icons/delete-outline.svg rename to labelCloud/resources/icons/delete-outline.svg diff --git a/labelCloud/ressources/icons/download.svg b/labelCloud/resources/icons/download.svg similarity index 100% rename from labelCloud/ressources/icons/download.svg rename to labelCloud/resources/icons/download.svg diff --git a/labelCloud/ressources/icons/labelCloud.ico b/labelCloud/resources/icons/labelCloud.ico similarity index 100% rename from labelCloud/ressources/icons/labelCloud.ico rename to labelCloud/resources/icons/labelCloud.ico diff --git a/labelCloud/ressources/icons/labelCloud_icon.png b/labelCloud/resources/icons/labelCloud_icon.png similarity index 100% rename from labelCloud/ressources/icons/labelCloud_icon.png rename to labelCloud/resources/icons/labelCloud_icon.png diff --git a/labelCloud/ressources/icons/minus-box-multiple-outline.svg b/labelCloud/resources/icons/minus-box-multiple-outline.svg similarity index 100% rename from labelCloud/ressources/icons/minus-box-multiple-outline.svg rename to labelCloud/resources/icons/minus-box-multiple-outline.svg diff --git a/labelCloud/ressources/icons/panorama.svg b/labelCloud/resources/icons/panorama.svg similarity index 100% rename from labelCloud/ressources/icons/panorama.svg rename to labelCloud/resources/icons/panorama.svg diff --git a/labelCloud/ressources/icons/plus-box-multiple-outline.svg b/labelCloud/resources/icons/plus-box-multiple-outline.svg similarity index 100% rename from labelCloud/ressources/icons/plus-box-multiple-outline.svg rename to labelCloud/resources/icons/plus-box-multiple-outline.svg diff --git a/labelCloud/ressources/icons/resize.svg b/labelCloud/resources/icons/resize.svg similarity index 100% rename from labelCloud/ressources/icons/resize.svg rename to labelCloud/resources/icons/resize.svg diff --git a/labelCloud/ressources/icons/select-off.svg b/labelCloud/resources/icons/select-off.svg similarity index 100% rename from labelCloud/ressources/icons/select-off.svg rename to labelCloud/resources/icons/select-off.svg diff --git a/labelCloud/ressources/icons/upload.svg b/labelCloud/resources/icons/upload.svg similarity index 100% rename from labelCloud/ressources/icons/upload.svg rename to labelCloud/resources/icons/upload.svg diff --git a/labelCloud/ressources/interfaces/__init__.py b/labelCloud/resources/interfaces/__init__.py similarity index 100% rename from labelCloud/ressources/interfaces/__init__.py rename to labelCloud/resources/interfaces/__init__.py diff --git a/labelCloud/ressources/interfaces/interface.ui b/labelCloud/resources/interfaces/interface.ui similarity index 100% rename from labelCloud/ressources/interfaces/interface.ui rename to labelCloud/resources/interfaces/interface.ui diff --git a/labelCloud/ressources/interfaces/settings_interface.ui b/labelCloud/resources/interfaces/settings_interface.ui similarity index 100% rename from labelCloud/ressources/interfaces/settings_interface.ui rename to labelCloud/resources/interfaces/settings_interface.ui diff --git a/labelCloud/ressources/labelCloud_icon.pcd b/labelCloud/resources/labelCloud_icon.pcd similarity index 100% rename from labelCloud/ressources/labelCloud_icon.pcd rename to labelCloud/resources/labelCloud_icon.pcd diff --git a/labelCloud/ressources/rocket-palette.txt b/labelCloud/resources/rocket-palette.txt similarity index 100% rename from labelCloud/ressources/rocket-palette.txt rename to labelCloud/resources/rocket-palette.txt diff --git a/labelCloud/tests/unit/conftest.py b/labelCloud/tests/unit/conftest.py index ae3ce6b..388f537 100644 --- a/labelCloud/tests/unit/conftest.py +++ b/labelCloud/tests/unit/conftest.py @@ -1,6 +1,14 @@ import os +from pathlib import Path + +import pytest def pytest_configure(config): os.chdir("../labelCloud") print(f"Set working directory to {os.getcwd()}.") + + +@pytest.fixture +def tmppath(tmpdir): + return Path(tmpdir) diff --git a/labelCloud/tests/unit/test_label_export.py b/labelCloud/tests/unit/test_label_export.py index 7e1098e..3a772ed 100644 --- a/labelCloud/tests/unit/test_label_export.py +++ b/labelCloud/tests/unit/test_label_export.py @@ -1,6 +1,7 @@ # Testing the correct processing of labels for the export in different formats import json import os +from pathlib import Path import pytest from labelCloud.control.label_manager import LabelManager @@ -15,86 +16,83 @@ def bounding_box(): return test_bbox -def test_vertices_export(bounding_box, tmpdir): - label_manager = LabelManager(strategy="vertices", path_to_label_folder=tmpdir) - label_manager.export_labels("testfolder/testpcd.ply", [bounding_box]) +def test_vertices_export(bounding_box, tmppath): + label_manager = LabelManager(strategy="vertices", path_to_label_folder=tmppath) + pcd_path = Path("testfolder/testpcd.ply") + label_manager.export_labels(pcd_path, [bounding_box]) - with open(os.path.join(tmpdir, "testpcd.json"), "r") as read_file: + with tmppath.joinpath("testpcd.json").open("r") as read_file: data = json.load(read_file) - assert data == { - "folder": "testfolder", - "filename": "testpcd.ply", - "path": "testfolder/testpcd.ply", - "objects": [ - { - "name": "test_bbox", - "vertices": [ - [0.5, -0.5, 0.5], - [0.5, -0.5, -0.5], - [0.5, 0.5, -0.5], - [0.5, 0.5, 0.5], - [-0.5, -0.5, 0.5], - [-0.5, -0.5, -0.5], - [-0.5, 0.5, -0.5], - [-0.5, 0.5, 0.5], - ], - } - ], - } - - -def test_centroid_rel_export(bounding_box, tmpdir): - label_manager = LabelManager(strategy="centroid_rel", path_to_label_folder=tmpdir) - label_manager.export_labels("testfolder/testpcd.ply", [bounding_box]) - - with open(os.path.join(tmpdir, "testpcd.json"), "r") as read_file: + assert data["folder"] == "testfolder" + assert data["filename"] == "testpcd.ply" + assert data["path"] == str(pcd_path) + assert data["objects"] == [ + { + "name": "test_bbox", + "vertices": [ + [0.5, -0.5, 0.5], + [0.5, -0.5, -0.5], + [0.5, 0.5, -0.5], + [0.5, 0.5, 0.5], + [-0.5, -0.5, 0.5], + [-0.5, -0.5, -0.5], + [-0.5, 0.5, -0.5], + [-0.5, 0.5, 0.5], + ], + } + ] + + +def test_centroid_rel_export(bounding_box, tmppath): + label_manager = LabelManager(strategy="centroid_rel", path_to_label_folder=tmppath) + pcd_path = Path("testfolder/testpcd.ply") + label_manager.export_labels(pcd_path, [bounding_box]) + + with tmppath.joinpath("testpcd.json").open("r") as read_file: data = json.load(read_file) - assert data == { - "folder": "testfolder", - "filename": "testpcd.ply", - "path": "testfolder/testpcd.ply", - "objects": [ - { - "name": "test_bbox", - "centroid": {"x": 0, "y": 0, "z": 0}, - "dimensions": {"length": 1, "width": 1, "height": 1}, - "rotations": {"x": 1.57079633, "y": 3.14159265, "z": -1.57079633}, - } - ], - } - - -def test_centroid_abs_export(bounding_box, tmpdir): - label_manager = LabelManager(strategy="centroid_abs", path_to_label_folder=tmpdir) - label_manager.export_labels("testfolder/testpcd.ply", [bounding_box]) - - with open(os.path.join(tmpdir, "testpcd.json"), "r") as read_file: + assert data["folder"] == "testfolder" + assert data["filename"] == "testpcd.ply" + assert data["path"] == str(pcd_path) + assert data["objects"] == [ + { + "name": "test_bbox", + "centroid": {"x": 0, "y": 0, "z": 0}, + "dimensions": {"length": 1, "width": 1, "height": 1}, + "rotations": {"x": 1.57079633, "y": 3.14159265, "z": -1.57079633}, + } + ] + + +def test_centroid_abs_export(bounding_box, tmppath): + label_manager = LabelManager(strategy="centroid_abs", path_to_label_folder=tmppath) + pcd_path = Path("testfolder/testpcd.ply") + label_manager.export_labels(pcd_path, [bounding_box]) + + with tmppath.joinpath("testpcd.json").open("r") as read_file: data = json.load(read_file) - assert data == { - "folder": "testfolder", - "filename": "testpcd.ply", - "path": "testfolder/testpcd.ply", - "objects": [ - { - "name": "test_bbox", - "centroid": {"x": 0, "y": 0, "z": 0}, - "dimensions": {"length": 1, "width": 1, "height": 1}, - "rotations": {"x": 90, "y": 180, "z": 270}, - } - ], - } - - -def test_kitti_export(bounding_box, tmpdir): + assert data["folder"] == "testfolder" + assert data["filename"] == "testpcd.ply" + assert data["path"] == str(pcd_path) + assert data["objects"] == [ + { + "name": "test_bbox", + "centroid": {"x": 0, "y": 0, "z": 0}, + "dimensions": {"length": 1, "width": 1, "height": 1}, + "rotations": {"x": 90, "y": 180, "z": 270}, + } + ] + + +def test_kitti_export(bounding_box, tmppath): label_manager = LabelManager( - strategy="kitti_untransformed", path_to_label_folder=tmpdir + strategy="kitti_untransformed", path_to_label_folder=tmppath ) - label_manager.export_labels("testfolder/testpcd.ply", [bounding_box]) + label_manager.export_labels(Path("testfolder/testpcd.ply"), [bounding_box]) - with open(os.path.join(tmpdir, "testpcd.txt"), "r") as read_file: + with tmppath.joinpath("testpcd.txt").open("r") as read_file: data = read_file.readlines() assert data == ["test_bbox 0 0 0 0 0 0 0 1 1 1 0 0 0 -1.57079633\n"] diff --git a/labelCloud/tests/unit/test_label_import.py b/labelCloud/tests/unit/test_label_import.py index 26efbd0..64d089f 100644 --- a/labelCloud/tests/unit/test_label_import.py +++ b/labelCloud/tests/unit/test_label_import.py @@ -1,4 +1,5 @@ import os +from pathlib import Path import pytest from labelCloud.control.label_manager import LabelManager @@ -17,14 +18,14 @@ def label_centroid(): # absolute and relative "label_format, rotation", [("centroid_abs", (0, 0, 1.616616)), ("centroid_rel", (0, 0, 92.6252738933211))], ) -def test_centroid_import(label_centroid, tmpdir, label_format, rotation): +def test_centroid_import(label_centroid, tmppath, label_format, rotation): # Write label to file - with open(os.path.join(tmpdir, "test.json"), "w") as write_file: + with tmppath.joinpath("test.json").open("w") as write_file: write_file.write(label_centroid) # Import label file - label_manager = LabelManager(strategy=label_format, path_to_label_folder=tmpdir) - bounding_boxes = label_manager.import_labels("test.ply") + label_manager = LabelManager(strategy=label_format, path_to_label_folder=tmppath) + bounding_boxes = label_manager.import_labels(Path("test.ply")) bbox = bounding_boxes[0] # Check label content @@ -43,14 +44,14 @@ def label_vertices(): return label -def test_vertices(label_vertices, tmpdir): +def test_vertices(label_vertices, tmppath): # Write label to file - with open(os.path.join(tmpdir, "test.json"), "w") as write_file: + with tmppath.joinpath("test.json").open("w") as write_file: write_file.write(label_vertices) # Import label file - label_manager = LabelManager(strategy="vertices", path_to_label_folder=tmpdir) - bounding_boxes = label_manager.import_labels("test.ply") + label_manager = LabelManager(strategy="vertices", path_to_label_folder=tmppath) + bounding_boxes = label_manager.import_labels(Path("test.ply")) bbox = bounding_boxes[0] # Check label content @@ -68,16 +69,16 @@ def label_kitti(): return label -def test_kitti(label_kitti, tmpdir): +def test_kitti(label_kitti, tmppath): # Write label to file - with open(os.path.join(tmpdir, "test.txt"), "w") as write_file: + with open(os.path.join(tmppath, "test.txt"), "w") as write_file: write_file.write(label_kitti) # Import label file label_manager = LabelManager( - strategy="kitti_untransformed", path_to_label_folder=tmpdir + strategy="kitti_untransformed", path_to_label_folder=tmppath ) - bounding_boxes = label_manager.import_labels("test.txt") + bounding_boxes = label_manager.import_labels(Path("test.txt")) bbox = bounding_boxes[0] # Check label content diff --git a/labelCloud/view/gui.py b/labelCloud/view/gui.py index 296588b..de64b9d 100644 --- a/labelCloud/view/gui.py +++ b/labelCloud/view/gui.py @@ -1,4 +1,3 @@ -import os import re from pathlib import Path from typing import TYPE_CHECKING, List, Set @@ -81,7 +80,7 @@ def __init__(self, control: "Controller") -> None: super(GUI, self).__init__() uic.loadUi( pkg_resources.resource_filename( - "labelCloud.ressources.interfaces", "interface.ui" + "labelCloud.resources.interfaces", "interface.ui" ), self, ) @@ -92,7 +91,7 @@ def __init__(self, control: "Controller") -> None: icons_dir=str( Path(__file__) .resolve() - .parent.parent.joinpath("ressources") + .parent.parent.joinpath("resources") .joinpath("icons") ) ) @@ -422,12 +421,11 @@ def show_settings_dialog(self) -> None: def show_2d_image(self): """Searches for a 2D image with the point cloud name and displays it in a new window.""" - - image_folder = os.path.join(config.get("FILE", "image_folder")) + image_folder = config.getpath("FILE", "image_folder") # Look for image files with the name of the point cloud - files_in_image_folder = os.listdir(image_folder) - pcd_name = os.path.splitext(self.controller.pcd_manager.get_current_name())[0] + files_in_image_folder = sorted(image_folder.iterdir()) + pcd_name = self.controller.pcd_manager.pcd_path.stem image_file_pattern = re.compile(f"{pcd_name}+(\.(?i:(jpe?g|png|gif|bmp|tiff)))") try: @@ -443,15 +441,15 @@ def show_2d_image(self): QMessageBox.Ok, ) else: - image_path = os.path.join(image_folder, image_name) - image = QtGui.QImage(QtGui.QImageReader(image_path).read()) + image_path = image_folder.joinpath(image_name) + image = QtGui.QImage(QtGui.QImageReader(str(image_path)).read()) self.imageLabel = QLabel() self.imageLabel.setWindowTitle(f"2D Image ({image_name})") self.imageLabel.setPixmap(QPixmap.fromImage(image)) self.imageLabel.show() def show_no_pointcloud_dialog( - self, pcd_folder: str, pcd_extensions: List[str] + self, pcd_folder: Path, pcd_extensions: List[str] ) -> None: msg = QMessageBox(self) msg.setIcon(QMessageBox.Warning) diff --git a/labelCloud/view/settings_dialog.py b/labelCloud/view/settings_dialog.py index c0df3c5..ae5e90e 100644 --- a/labelCloud/view/settings_dialog.py +++ b/labelCloud/view/settings_dialog.py @@ -12,7 +12,7 @@ def __init__(self, parent=None) -> None: self.parent_gui = parent uic.loadUi( pkg_resources.resource_filename( - "labelCloud.ressources.interfaces", "settings_interface.ui" + "labelCloud.resources.interfaces", "settings_interface.ui" ), self, ) diff --git a/labelCloud/view/viewer.py b/labelCloud/view/viewer.py index 92f08c4..dcc74c3 100644 --- a/labelCloud/view/viewer.py +++ b/labelCloud/view/viewer.py @@ -64,7 +64,7 @@ def initializeGL(self) -> None: print("Intialized widget.") # Must be written again, due to buffer clearing - self.pcd_manager.get_pointcloud().write_vbo() + self.pcd_manager.pointcloud.write_vbo() def resizeGL(self, width, height) -> None: print("Resized widget.") @@ -81,7 +81,7 @@ def paintGL(self) -> None: GL.glPushMatrix() # push the current matrix to the current stack # Draw point cloud - self.pcd_manager.get_pointcloud().draw_pointcloud() + self.pcd_manager.pointcloud.draw_pointcloud() # Get actual matrices for click unprojection self.modelview = GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX) @@ -91,7 +91,7 @@ def paintGL(self) -> None: GL.glDepthMask(GL.GL_FALSE) if config.getboolean("USER_INTERFACE", "show_floor"): - oglhelper.draw_xy_plane(self.pcd_manager.get_pointcloud()) + oglhelper.draw_xy_plane(self.pcd_manager.pointcloud) # Draw crosshair/ cursor in 3D world if self.crosshair_pos: diff --git a/labels/exemplary.json b/labels/exemplary.json index b26d719..85cbaf2 100644 --- a/labels/exemplary.json +++ b/labels/exemplary.json @@ -6,19 +6,19 @@ { "name": "cart", "centroid": { - "x": -0.20347, - "y": -0.216727, - "z": 0.065128 + "x": 0.07909935, + "y": -0.45287216, + "z": 0.06679061 }, "dimensions": { - "length": 0.75, - "width": 0.55, - "height": 0.15 + "length": 0.52255022, + "width": 0.38638801, + "height": 0.1134028 }, "rotations": { "x": 0, "y": 0, - "z": 236 + "z": 55.16302286 } } ] diff --git a/setup.cfg b/setup.cfg index b17814f..6ddced6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,10 +39,10 @@ packages = labelCloud.label_formats labelCloud.labeling_strategies labelCloud.model - labelCloud.ressources - labelCloud.ressources.examples - labelCloud.ressources.icons - labelCloud.ressources.interfaces + labelCloud.resources + labelCloud.resources.examples + labelCloud.resources.icons + labelCloud.resources.interfaces labelCloud.tests labelCloud.utils labelCloud.view @@ -62,7 +62,7 @@ console_scripts = tests = pytest; pytest-qt [options.package_data] -labelCloud.ressources = *.ini, *.pcd, *.txt -labelCloud.ressources.examples = *.json, *.ply -labelCloud.ressources.icons = *.ico, *.png, *.svg, *.txt -labelCloud.ressources.interfaces = *.ui +labelCloud.resources = *.ini, *.pcd, *.txt +labelCloud.resources.examples = *.json, *.ply +labelCloud.resources.icons = *.ico, *.png, *.svg, *.txt +labelCloud.resources.interfaces = *.ui