CENTRE-FOR-SMART-TRANSPORTATION / cst-pointcloud-annotation-2023

For labelling 3D bounding boxes of point clouds.
https://ch-sa.github.io/labelCloud/
GNU General Public License v3.0
0 stars 1 forks source link

Suggestion 2 & 3: Better camera options #2

Open echeng-git opened 1 year ago

echeng-git commented 1 year ago

As of now, the camera options only really work for smaller point clouds (such as the one in the example), since the center of camera rotation appears to be fixed. The standard zoom factor is also constant as well.

Implement a variable center of rotation, and variable zoom factor similar to that of CloudCompare.

References to the zoom factor (originally defined in the configuration as a constant value) can be found in labelCloud/control/Controller.py, in the mouse_scroll_event() method and subsequently the zoom_into() method in labelCloud/control/pcd_manager.py.

References to camera rotation can be in the mouse_move_event() in Controller.py, and subsequently pcd_manager.py as mentioned above.

echeng-git commented 1 year ago

References to the actual rotations and trasnlations carried out with OpenGL can be found in labelCloud/model/point_cloud.py, in the set_gl_background() method, which is constantly updated.

Note that the glTranslate() and glRotate() methods have to do with rotating the entire point cloud in this case. The rotation center can be changed by changing the value of pcd_center in the set_gl_background() method.

We could add a widget where we doubleclick on the screen to set the rotation center in a similar way to CloudCompare, by changing pcd_center.

echeng-git commented 1 year ago

In order to zoom in and out with the scroll wheel from the zoom_into() method, trans_z of the currently displayed point cloud is changed by the set_trans_z() method.

Here is a code snippet of the zoom_into method of pcd_manager.py:

    def zoom_into(self, distance) -> None:
        assert self.pointcloud is not None
        zoom_distance = distance * PointCloudManger.ZOOM_FACTOR
        self.pointcloud.set_trans_z(self.pointcloud.trans_z + zoom_distance)

When trans_z of the current point cloud is set, it is automatically updated in the set_gl_background method of the currently selected point cloud (point_cloud.py).