-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ch-sa/gui-settings
Add visual config editor
- Loading branch information
Showing
16 changed files
with
1,120 additions
and
244 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,54 @@ | ||
[FILE] | ||
; Source of point clouds | ||
POINTCLOUD_FOLDER = pointclouds/ | ||
; Sink for label files | ||
LABEL_FOLDER = labels/ | ||
; source of point clouds | ||
pointcloud_folder = pointclouds/ | ||
; sink for label files | ||
label_folder = labels/ | ||
|
||
[POINTCLOUD] | ||
; Drawing size for points in point cloud | ||
POINT_SIZE = 4 | ||
; Point color for colorless point clouds (r,g,b) | ||
COLORLESS_COLOR = 0.9, 0.9, 0.9 | ||
; Colerize colorless point clouds by height value | ||
COLORLESS_COLORIZE = True | ||
STD_TRANSLATION = 0.03 | ||
STD_ZOOM = 0.0025 | ||
; drawing size for points in point cloud | ||
point_size = 4.0 | ||
; point color for colorless point clouds (r,g,b) | ||
colorless_color = 0.9, 0.9, 0.9 | ||
; colerize colorless point clouds by height value | ||
colorless_colorize = True | ||
; standard step for point cloud translation (for mouse move) | ||
std_translation = 0.03 | ||
; standard step for zooming (for scrolling) | ||
std_zoom = 0.0025 | ||
|
||
[LABEL] | ||
LABEL_FORMAT = centroid_abs | ||
OBJECT_CLASSES = cart, box | ||
STD_OBJECT_CLASS = cart | ||
Z_ROTATION_ONLY = True | ||
EXPORT_PRECISION = 8 | ||
VIEWING_PRECISION = 3 | ||
MIN_BOUNDINGBOX_DIMENSION = 0.01 | ||
STD_BOUNDINGBOX_LENGTH = 0.75 | ||
STD_BOUNDINGBOX_WIDTH = 0.55 | ||
STD_BOUNDINGBOX_HEIGHT = 0.15 | ||
STD_TRANSLATION = 0.03 | ||
STD_ROTATION = 0.5 | ||
STD_SCALING = 0.03 | ||
; format for exporting labels. choose from (vertices, centroid_rel, centroid_abs, kitti) | ||
label_format = centroid_abs | ||
; list of object classes for autocompletion in the text field | ||
object_classes = cart, box | ||
; default object class for new bounding boxes | ||
std_object_class = cart | ||
; number of decimal places for exporting the bounding box parameter. | ||
export_precision = 8 | ||
; default length of the bounding box (for picking mode) | ||
std_boundingbox_length = 0.75 | ||
; default width of the bounding box (for picking mode) | ||
std_boundingbox_width = 0.55 | ||
; default height of the bounding box (for picking mode) | ||
std_boundingbox_height = 0.15 | ||
; standard step for translating the bounding box with button or key (in meter) | ||
std_translation = 0.03 | ||
; standard step for rotating the bounding box with button or key (in degree) | ||
std_rotation = 0.5 | ||
; standard step for scaling the bounding box with button | ||
std_scaling = 0.03 | ||
; minimum value for the length, width and height of a bounding box | ||
min_boundingbox_dimension = 0.01 | ||
|
||
[USER_INTERFACE] | ||
; only allow z-rotation of bounding boxes. set false to also label x- & y-rotation | ||
z_rotation_only = True | ||
; visualizes the pointcloud floor (x-y-plane) as a grid | ||
show_floor = True | ||
; visualizes the object's orientation with an arrow | ||
show_orientation = True | ||
; background color of the point cloud viewer (rgb) | ||
background_color = 100, 100, 100 | ||
; number of decimal places shown for the parameters of the active bounding box | ||
viewing_precision = 2 | ||
|
||
[SETTINGS] | ||
BACKGROUND_COLOR = 100, 100, 100 | ||
SHOW_FLOOR = True | ||
SHOW_ORIENTATION = True |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Load configuration from .ini file.""" | ||
import configparser | ||
|
||
# Read local file `config.ini`. | ||
import os | ||
from typing import List, Union, Optional | ||
|
||
|
||
class ExtendedConfigParser(configparser.ConfigParser): | ||
|
||
def getlist(self, section, option, raw=False, vars=None, fallback=None) -> List: | ||
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(',')] | ||
try: | ||
return [float(item) for item in values] | ||
except ValueError: | ||
return values | ||
return raw_value | ||
|
||
|
||
class ConfigManager(object): | ||
PATH_TO_CONFIG = "config.ini" | ||
PATH_TO_DEFAULT_CONFIG = "ressources/default_config.ini" | ||
|
||
def __init__(self): | ||
self.config = ExtendedConfigParser(comment_prefixes='/', allow_no_value=True) | ||
self.read_from_file() | ||
|
||
def read_from_file(self): | ||
if os.path.isfile(ConfigManager.PATH_TO_CONFIG): | ||
self.config.read(ConfigManager.PATH_TO_CONFIG) | ||
else: | ||
self.config.read(ConfigManager.PATH_TO_DEFAULT_CONFIG) | ||
|
||
def write_into_file(self): | ||
with open(ConfigManager.PATH_TO_CONFIG, 'w') as configfile: | ||
self.config.write(configfile, space_around_delimiters=True) | ||
|
||
def reset_to_default(self): | ||
self.config.read(ConfigManager.PATH_TO_DEFAULT_CONFIG) | ||
|
||
def get_file_settings(self, key: str) -> str: | ||
return self.config["FILE"][key] | ||
|
||
|
||
config_manager = ConfigManager() | ||
config = config_manager.config |
Oops, something went wrong.