Skip to content

Commit

Permalink
Merge pull request #61 from ch-sa/sager/fix-get-pcd
Browse files Browse the repository at this point in the history
Fix point cloud getter
  • Loading branch information
ch-sa authored Feb 5, 2022
2 parents 48e53e0 + 1f37f71 commit 88b29c2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion labelCloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.3"
__version__ = "0.7.4"
13 changes: 7 additions & 6 deletions labelCloud/control/bbox_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from ..model.bbox import BBox
from ..utils import oglhelper
from .config_manager import config
from .pcd_manager import PointCloudManger

if TYPE_CHECKING:
from ..view.gui import GUI
Expand Down Expand Up @@ -52,10 +53,10 @@ class BoundingBoxController(object):
STD_SCALING = config.getfloat("LABEL", "std_scaling")

def __init__(self) -> None:
self.view = None
self.bboxes = []
self.view: Optional[GUI] = None
self.bboxes: List[BBox] = []
self.active_bbox_id = -1 # -1 means zero bboxes
self.pcdc = None
self.pcd_manager: Optional[PointCloudManger] = None

# GETTERS
def has_active_bbox(self) -> bool:
Expand Down Expand Up @@ -208,7 +209,7 @@ def rotate_with_mouse(
self, x_angle: float, y_angle: float
) -> None: # TODO: Make more intuitive
# Get bbox perspective
pcd_z_rotation = self.pcdc.get_pointcloud().rot_z
pcd_z_rotation = self.pcd_manager.pointcloud.rot_z
bbox_z_rotation = self.get_active_bbox().get_z_rotation()
total_z_rotation = pcd_z_rotation + bbox_z_rotation

Expand All @@ -224,7 +225,7 @@ def translate_along_x(self, distance: float = None, left: bool = False) -> None:
distance = distance or config.getfloat("LABEL", "std_translation")
if left:
distance *= -1
cosz, sinz, bu = self.pcdc.get_perspective()
cosz, sinz, bu = self.pcd_manager.get_perspective()
self.get_active_bbox().set_x_translation(
self.get_active_bbox().center[0] + distance * cosz
)
Expand All @@ -237,7 +238,7 @@ def translate_along_y(self, distance: float = None, forward: bool = False) -> No
distance = distance or config.getfloat("LABEL", "std_translation")
if forward:
distance *= -1
cosz, sinz, bu = self.pcdc.get_perspective()
cosz, sinz, bu = self.pcd_manager.get_perspective()
self.get_active_bbox().set_x_translation(
self.get_active_bbox().center[0] + distance * bu * -sinz
)
Expand Down
2 changes: 1 addition & 1 deletion labelCloud/control/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def startup(self, view: "GUI") -> None:
self.drawing_mode.set_view(self.view)
self.align_mode.set_view(self.view)
self.view.glWidget.set_bbox_controller(self.bbox_controller)
self.bbox_controller.pcdc = self.pcd_manager
self.bbox_controller.pcd_manager = self.pcd_manager

# Read labels from folders
self.pcd_manager.read_pointcloud_folder()
Expand Down
4 changes: 2 additions & 2 deletions labelCloud/utils/math3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ def get_line_perpendicular(
b = m * -line_end[0] + line_end[1]

# Calculate line perpendicular parallel to x-y-plane
intersection_x = (point[0] + m * (point[1] - b)) / (1 + m ** 2)
intersection_y = (m * point[0] + m ** 2 * point[1] + b) / (1 + m ** 2)
intersection_x = (point[0] + m * (point[1] - b)) / (1 + m**2)
intersection_y = (m * point[0] + m**2 * point[1] + b) / (1 + m**2)
dir_vector = (
point[0] - intersection_x,
point[1] - intersection_y,
Expand Down
2 changes: 1 addition & 1 deletion labelCloud/view/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def circular_mask(arr_length, center, radius) -> np.ndarray:
dx = np.arange(arr_length)
return (dx[np.newaxis, :] - center) ** 2 + (
dx[:, np.newaxis] - center
) ** 2 < radius ** 2
) ** 2 < radius**2


# Returns the minimum (closest) depth for a specified radius around the center
Expand Down

0 comments on commit 88b29c2

Please sign in to comment.