RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
Frustum Filtering

Filters points from a point cloud based on a camera frustum. More...

Functions

pcl::IndicesPtr RTABMAP_CORE_EXPORT rtabmap::util3d::frustumFiltering (const pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud, const pcl::IndicesPtr &indices, const Transform &cameraPose, float horizontalFOV, float verticalFOV, float nearClipPlaneDistance, float farClipPlaneDistance, bool negative=false)
 Performs frustum filtering on a point cloud of type pcl::PointXYZ and returns filtered indices.
 
pcl::PointCloud< pcl::PointXYZ >::Ptr RTABMAP_CORE_EXPORT rtabmap::util3d::frustumFiltering (const pcl::PointCloud< pcl::PointXYZ >::Ptr &cloud, const Transform &cameraPose, float horizontalFOV, float verticalFOV, float nearClipPlaneDistance, float farClipPlaneDistance, bool negative=false)
 Performs frustum filtering on a point cloud of type pcl::PointXYZ and returns a new point cloud of the filtered points.
 
pcl::PointCloud< pcl::PointXYZRGB >::Ptr RTABMAP_CORE_EXPORT rtabmap::util3d::frustumFiltering (const pcl::PointCloud< pcl::PointXYZRGB >::Ptr &cloud, const Transform &cameraPose, float horizontalFOV, float verticalFOV, float nearClipPlaneDistance, float farClipPlaneDistance, bool negative=false)
 Performs frustum filtering on a point cloud of type pcl::PointXYZRGB and returns a new point cloud of the filtered points.
 

Detailed Description

Filters points from a point cloud based on a camera frustum.

This function uses PCL's FrustumCulling filter to include or exclude points from a 3D point cloud that lie within a specified camera frustum. The frustum is defined by vertical and horizontal field of view angles, near and far clipping planes, and the camera pose. It can optionally apply filtering on a subset of points specified by indices.

Note
This assumes the pose includes the optical rotation of the camera (X right, Y down, Z forward).
Parameters
cloudA pointer to the input point cloud to be filtered.
indicesA pointer to the subset of indices in the point cloud to consider for filtering. Pass nullptr to apply the filter to the full cloud.
cameraPoseThe transformation representing the camera pose in world coordinates. This defines the position and orientation of the frustum.
horizontalFOVThe horizontal field of view in degrees (e.g., computed as atan((image width/2)/fx) * 2).
verticalFOVThe vertical field of view in degrees (e.g., atan((image height/2)/fy) * 2).
nearClipPlaneDistanceThe distance from the camera to the near clipping plane.
farClipPlaneDistanceThe distance from the camera to the far clipping plane.
negativeIf true, the filter will exclude points inside the frustum. If false, it will include only those inside.
Returns
The indices representing the points that passed the filter, or a new filtered point cloud.
Exceptions
Assertionfailure if:
  • horizontalFOV <= 0 or verticalFOV <= 0,
  • farClipPlaneDistance <= nearClipPlaneDistance,
  • cameraPose is null.