introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.74k stars 779 forks source link

CloudViewer: addOrUpdateFrustum doesn't show correctly the actual frustum (with cx/cy offsets) #1216

Open matlabbe opened 7 months ago

matlabbe commented 7 months ago

The problem with the current way to display it is that cx/cy are assumed to be exactly at the center of the image, which often are not, so the frustum shown is the ideal straight frustum based on field of view.

Similarly to jsk camera info display using image_geometry::PinholeCameraModel::projectPixelTo3dRay to find the 4 corners of the frustum, we could use internal CameraModel::project() with depth=1 (or actual max distance of the frustum) to get the four corners: https://github.com/introlab/rtabmap/blob/1dadd50cf292cce4477f4a026e3a969c42c0baef/corelib/src/CameraModel.cpp#L766-L773