Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard shortcuts for scaling, allow loading files recursively #161

Merged
merged 6 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,16 @@ All rotations are counterclockwise (i.e. a z-rotation of 90°/π is from the pos
| `W`, `A`, `S`, `D` | Translates the Bounding Box back, left, front, right |
| `Ctrl` + Right Mouse Button | Translates the Bounding Box in all dimensions |
| `Q`, `E` | Lifts the Bounding Box up, down |
| `Z`, `X` | Rotates the Boundign Box around z-Axis |
| `C`, `V` | Rotates the Boundign Box around y-Axis |
| `B`, `N` | Rotates the Boundign Box around x-Axis |
| `Z`, `X` | Rotates the Bounding Box around z-Axis |
| `C`, `V` | Rotates the Bounding Box around y-Axis |
| `B`, `N` | Rotates the Bounding Box around x-Axis |
| `I`/ `O` | Increase/Decrease the Bounding Box length |
| `K`/ `L` | Increase/Decrease the Bounding Box width |
| `,`/ `.` | Increase/Decrease the Bounding Box height |
| Scrolling with the Cursor above a Bounding Box Side ("Side Pulling") | Changes the Dimension of the Bounding Box |
| `R`/`Left`, `F`/`Right` | Previous/Next sample |
| `T`/`Up`, `G`/`Down` | Previous/Next bbox |
| `Y`/`,`,`H`/`.` | Change current bbox class to previous/next in list |
| `Y`, `H` | Change current bbox class to previous/next in list |
| `1`-`9` | Select any of first 9 bboxes with number keys |
| *General* | |
| `Del` | Deletes Current Bounding Box |
Expand Down Expand Up @@ -150,11 +153,11 @@ If you are using the tool for a scientific project please consider citing our [p
author = {Christoph Sager and Patrick Zschech and Niklas Kuhl},
title = {{labelCloud}: A Lightweight Labeling Tool for Domain-Agnostic 3D Object Detection in Point Clouds},
journal = {Computer-Aided Design and Applications}
}
}

# CAD Conference
@misc{sager2021labelcloud,
title={labelCloud: A Lightweight Domain-Independent Labeling Tool for 3D Object Detection in Point Clouds},
title={labelCloud: A Lightweight Domain-Independent Labeling Tool for 3D Object Detection in Point Clouds},
author={Christoph Sager and Patrick Zschech and Niklas Kühl},
year={2021},
eprint={2103.04970},
Expand Down
23 changes: 16 additions & 7 deletions docs/shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,25 @@ There are a number of shortcuts supported for frequently used actions.
| Shortcut | Description |
| :------------------------------------------------------------------: | ---------------------------------------------------- |
| *Navigation* | |
| Left Mouse Button | Rotates the Point Cloud |
| Right Mouse Button | Translates the Point Cloud |
| Left Mouse Button | Rotates the camera around Point Cloud centroid |
| Right Mouse Button | Translates the camera |
| Mouse Wheel | Zooms into the Point Cloud |
| *Correction* | |
| `W`, `A`, `S`, `D` <br> `Ctrl` + Right Mouse Button | Translates the Bounding Box back, left, front, right |
| `W`, `A`, `S`, `D` | Translates the Bounding Box back, left, front, right |
| `Ctrl` + Right Mouse Button | Translates the Bounding Box in all dimensions |
| `Q`, `E` | Lifts the Bounding Box up, down |
| `X`, `Y` | Rotates the Boundign Box around z-Axis |
| `Z`, `X` | Rotates the Bounding Box around z-Axis |
| `C`, `V` | Rotates the Bounding Box around y-Axis |
| `B`, `N` | Rotates the Bounding Box around x-Axis |
| `I`/ `O` | Increase/Decrease the Bounding Box length |
| `K`/ `L` | Increase/Decrease the Bounding Box width |
| `,`/ `.` | Increase/Decrease the Bounding Box height |
| Scrolling with the Cursor above a Bounding Box Side ("Side Pulling") | Changes the Dimension of the Bounding Box |
| `C` & `V`, `B` & `N` | Rotates the Bounding Box around y-Axis, x-Axis |
| `R`/`Left`, `F`/`Right` | Previous/Next sample |
| `T`/`Up`, `G`/`Down` | Previous/Next bbox |
| `Y`, `H` | Change current bbox class to previous/next in list |
| `1`-`9` | Select any of first 9 bboxes with number keys |
| *General* | |
| `Del` | Deletes Current Bounding Box |
| `R` | Resets Perspective |
| `Esc` | Cancels Selected Points |
| `P`/`Home` | Resets Perspective |
| `Esc` | Cancels Selected Points |
39 changes: 39 additions & 0 deletions labelCloud/control/bbox_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,45 @@ def scale(

self.get_active_bbox().set_dimensions(new_length, new_width, new_height) # type: ignore

@has_active_bbox_decorator
def scale_along_length(
self, step: Optional[float] = None, decrease: bool = False
) -> None:
step = step or config.getfloat("LABEL", "std_scaling")
if decrease:
step *= -1

active_bbox: Bbox = self.get_active_bbox() # type: ignore
length, width, height = active_bbox.get_dimensions()
new_length = length + step
active_bbox.set_dimensions(new_length, width, height)

@has_active_bbox_decorator
def scale_along_width(
self, step: Optional[float] = None, decrease: bool = False
) -> None:
step = step or config.getfloat("LABEL", "std_scaling")
if decrease:
step *= -1

active_bbox: Bbox = self.get_active_bbox() # type: ignore
length, width, height = active_bbox.get_dimensions()
new_width = width + step
active_bbox.set_dimensions(length, new_width, height)

@has_active_bbox_decorator
def scale_along_height(
self, step: Optional[float] = None, decrease: bool = False
) -> None:
step = step or config.getfloat("LABEL", "std_scaling")
if decrease:
step *= -1

active_bbox: Bbox = self.get_active_bbox() # type: ignore
length, width, height = active_bbox.get_dimensions()
new_height = height + step
active_bbox.set_dimensions(length, width, new_height)

def select_bbox_by_ray(self, x: int, y: int) -> None:
intersected_bbox_id = oglhelper.get_intersected_bboxes(
x,
Expand Down
25 changes: 23 additions & 2 deletions labelCloud/control/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,27 @@ def key_press_event(self, a0: QtGui.QKeyEvent) -> None:
elif a0.key() == Keys.Key_E:
# move down
self.bbox_controller.translate_along_z(down=True)

# BBOX Scaling
elif a0.key() == Keys.Key_I:
# increase length
self.bbox_controller.scale_along_length()
elif a0.key() == Keys.Key_O:
# decrease length
self.bbox_controller.scale_along_length(decrease=True)
elif a0.key() == Keys.Key_K:
# increase width
self.bbox_controller.scale_along_width()
elif a0.key() == Keys.Key_L:
# decrease width
self.bbox_controller.scale_along_width(decrease=True)
elif a0.key() == Keys.Key_Comma:
# increase height
self.bbox_controller.scale_along_height()
elif a0.key() == Keys.Key_Period:
# decrease height
self.bbox_controller.scale_along_height(decrease=True)

elif a0.key() in [Keys.Key_R, Keys.Key_Left]:
# load previous sample
self.prev_pcd()
Expand All @@ -323,10 +344,10 @@ def key_press_event(self, a0: QtGui.QKeyEvent) -> None:
elif a0.key() in [Keys.Key_G, Keys.Key_Down]:
# select previous bbox
self.select_relative_bbox(1)
elif a0.key() in [Keys.Key_Y, Keys.Key_Comma]:
elif a0.key() in Keys.Key_Y:
# change bbox class to previous available class
self.select_relative_class(-1)
elif a0.key() in [Keys.Key_H, Keys.Key_Period]:
elif a0.key() in Keys.Key_H:
# change bbox class to next available class
self.select_relative_class(1)
elif a0.key() in list(range(49, 58)):
Expand Down
2 changes: 1 addition & 1 deletion labelCloud/control/pcd_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def read_pointcloud_folder(self) -> None:
"""Checks point cloud folder and sets self.pcds to all valid point cloud file names."""
if self.pcd_folder.is_dir():
self.pcds = []
for file in sorted(self.pcd_folder.iterdir()):
for file in sorted(self.pcd_folder.rglob("*")):
if file.suffix in PointCloudManger.PCD_EXTENSIONS:
self.pcds.append(file)
else:
Expand Down
Loading