Skip to content

Commit

Permalink
Keep perspective between point clouds
Browse files Browse the repository at this point in the history
 - add setting to keep perspective between point cloud changes
 - takes the last perspective before loading the new point cloud

Relates: #24
  • Loading branch information
ch-sa committed Oct 19, 2021
1 parent 37b878e commit edc363e
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 127 deletions.
9 changes: 6 additions & 3 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ show_orientation = True
background_color = 100, 100, 100
; number of decimal places shown for the parameters of the active bounding box
viewing_precision = 2
; near and far clipping plane for OpenGL (where objects are visible, in meter)
near_plane=0.1
far_plane=300
; near and far clipping plane for opengl (where objects are visible, in meter)
near_plane = 0.1
far_plane = 300
; keep last perspective between point clouds
keep_perspective = True

3 changes: 3 additions & 0 deletions labelCloud/control/pcd_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ def save_current_perspective(self, active: bool = True) -> None:
def load_pointcloud(self, path_to_pointcloud: str) -> PointCloud:
print("=" * 20, "Loading", ntpath.basename(path_to_pointcloud), "=" * 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
Expand Down
4 changes: 3 additions & 1 deletion labelCloud/ressources/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ background_color = 100, 100, 100
viewing_precision = 2
; near and far clipping plane for OpenGL (where objects are visible, in meter)
near_plane=0.1
far_plane=300
far_plane=300
; keep last perspective between point clouds
keep_perspective = False
254 changes: 132 additions & 122 deletions labelCloud/ressources/settings_interface.ui
Original file line number Diff line number Diff line change
Expand Up @@ -22,77 +22,64 @@
<property name="rightMargin">
<number>0</number>
</property>
<item row="4" column="1">
<widget class="QLabel" name="label_pointsize">
<item row="12" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_showbboxorientation">
<property name="toolTip">
<string>Rasterized diameter of each point from the point cloud.</string>
<string>Visualizes the object's orientation with an arrow.</string>
</property>
<property name="text">
<string>Point Size</string>
<string>Show Bounding Box Orientation</string>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QSpinBox" name="spinBox_viewingprecision">
<item row="14" column="1">
<widget class="QLabel" name="label_viewingprecision">
<property name="toolTip">
<string>number of decimal places shown for the parameters of the active bounding box.</string>
</property>
<property name="text">
<string>Viewing Precision of
Bounding Box Parameter</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_standardzoom">
<item row="6" column="1">
<widget class="QLabel" name="label_standardzoom">
<property name="toolTip">
<string>Standard step for zooming.</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
<property name="text">
<string>Standard Zoom Factor</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLineEdit" name="lineEdit_pointcolor">
<item row="2" column="2">
<widget class="QLineEdit" name="lineEdit_labelfolder">
<property name="toolTip">
<string>Point color for colorless point clouds (r,g,b).</string>
<string>Path to the folder where the label files will be saved.</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="title_filesettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="6" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_standardzoom">
<property name="toolTip">
<string>Standard step for zooming.</string>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<property name="decimals">
<number>4</number>
</property>
<property name="text">
<string>File Settings</string>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="label_pointcolor">
<item row="2" column="1">
<widget class="QLabel" name="label_labelfolder">
<property name="toolTip">
<string>Point color for colorless point clouds (r,g,b).</string>
<string>Path to the folder where the label files will be saved.</string>
</property>
<property name="text">
<string>Point Color
(for colorless point clouds)</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QLineEdit" name="lineEdit_backgroundcolor">
<property name="toolTip">
<string>Background color of the point cloud viewer (rgb).</string>
<string>Label Folder</string>
</property>
</widget>
</item>
Expand All @@ -106,29 +93,23 @@
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_colorizecolorless">
<item row="7" column="2">
<widget class="QLineEdit" name="lineEdit_pointcolor">
<property name="toolTip">
<string>Colerize colorless point clouds by height value.</string>
</property>
<property name="text">
<string>Colorize colorless point clouds by height</string>
<string>Point color for colorless point clouds (r,g,b).</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="title_userinterface">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="4" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_pointsize">
<property name="toolTip">
<string>Rasterized diameter of each point from the point cloud.</string>
</property>
<property name="styleSheet">
<string notr="true">margin-top: 10px</string>
<property name="decimals">
<number>2</number>
</property>
<property name="text">
<string>User Interface</string>
<property name="maximum">
<double>500.000000000000000</double>
</property>
</widget>
</item>
Expand All @@ -154,13 +135,43 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_labelfolder">
<item row="1" column="2">
<widget class="QLineEdit" name="lineEdit_pointcloudfolder">
<property name="toolTip">
<string>Path to the folder where the label files will be saved.</string>
<string>Path to the folder that contains the point cloud files.</string>
</property>
</widget>
</item>
<item row="10" column="2">
<widget class="QLineEdit" name="lineEdit_backgroundcolor">
<property name="toolTip">
<string>Background color of the point cloud viewer (rgb).</string>
</property>
</widget>
</item>
<item row="14" column="2">
<widget class="QSpinBox" name="spinBox_viewingprecision">
<property name="toolTip">
<string>number of decimal places shown for the parameters of the active bounding box.</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="title_filesettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Label Folder</string>
<string>File Settings</string>
</property>
</widget>
</item>
Expand All @@ -177,47 +188,39 @@
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="label_viewingprecision">
<item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_colorizecolorless">
<property name="toolTip">
<string>number of decimal places shown for the parameters of the active bounding box.</string>
<string>Colerize colorless point clouds by height value.</string>
</property>
<property name="text">
<string>Viewing Precision of
Bounding Box Parameter</string>
<string>Colorize colorless point clouds by height</string>
</property>
</widget>
</item>
<item row="14" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_standardtranslation">
<item row="10" column="1">
<widget class="QLabel" name="label_backgroundcolor">
<property name="toolTip">
<string>Standard step for point cloud translation.</string>
<string>Background color of the point cloud viewer (rgb).</string>
</property>
<property name="text">
<string>Standard Translation</string>
<string>Background Color</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_standardzoom">
<property name="toolTip">
<string>Standard step for zooming.</string>
<item row="9" column="1">
<widget class="QLabel" name="title_userinterface">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">margin-top: 10px</string>
</property>
<property name="text">
<string>Standard Zoom Factor</string>
<string>User Interface</string>
</property>
</widget>
</item>
Expand All @@ -231,62 +234,69 @@ Bounding Box Parameter</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_pointsize">
<item row="4" column="1">
<widget class="QLabel" name="label_pointsize">
<property name="toolTip">
<string>Rasterized diameter of each point from the point cloud.</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>500.000000000000000</double>
<property name="text">
<string>Point Size</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_showbboxorientation">
<property name="toolTip">
<string>Visualizes the object's orientation with an arrow.</string>
<item row="15" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>Show Bounding Box Orientation</string>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="lineEdit_pointcloudfolder">
<property name="toolTip">
<string>Path to the folder that contains the point cloud files.</string>
<item row="16" column="1" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Note: Some settings might require a restart to take effect!</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLabel" name="label_backgroundcolor">
<item row="5" column="1">
<widget class="QLabel" name="label_standardtranslation">
<property name="toolTip">
<string>Background color of the point cloud viewer (rgb).</string>
<string>Standard step for point cloud translation.</string>
</property>
<property name="text">
<string>Background Color</string>
<string>Standard Translation</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="lineEdit_labelfolder">
<item row="7" column="1">
<widget class="QLabel" name="label_pointcolor">
<property name="toolTip">
<string>Path to the folder where the label files will be saved.</string>
<string>Point color for colorless point clouds (r,g,b).</string>
</property>
<property name="text">
<string>Point Color
(for colorless point clouds)</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
<italic>true</italic>
</font>
<item row="13" column="1" colspan="2">
<widget class="QCheckBox" name="checkBox_keepperspective">
<property name="toolTip">
<string>Applies the last perspective of the previous point cloud to the current point cloud when loading.</string>
</property>
<property name="text">
<string>Note: Some settings might require a restart to take effect!</string>
<string>Keep last Perspective between Point Clouds</string>
</property>
</widget>
</item>
Expand Down
Loading

0 comments on commit edc363e

Please sign in to comment.