NVIDIA DeepStream SDK API Reference

9.2 Release
sources/gst-plugins/gst-nvdsvideotemplate/ds-sparse4d/postprocess/bbox3d_utils.h File Reference

Go to the source code of this file.

Functions

torch::Tensor generate_bbox3d_on_camera_frames (const torch::Tensor &bboxes3d, const torch::Tensor &projection_matrices)
 Converts 3D bounding boxes from world coordinates to camera coordinates. More...
 
torch::Tensor generate_bbox2d_from_rect3d (const torch::Tensor &rect3d, int image_width, int image_height)
 Generate 2D bounding boxes from projected 3D rectangle corners. More...
 
torch::Tensor box3d_to_corners (const torch::Tensor &box3d)
 Converts 3D bounding box parameters to corner points in 3D space. More...
 
void test_generate_bbox3d_on_camera_frames (PrettyLogger *logger)
 Test function to generate bbox3d on camera frames. More...
 

Function Documentation

◆ box3d_to_corners()

torch::Tensor box3d_to_corners ( const torch::Tensor &  box3d)

Converts 3D bounding box parameters to corner points in 3D space.

Parameters
box3dTorch tensor containing 3D bounding box parameters
Returns
Torch tensor containing corner points for each bounding box

◆ generate_bbox2d_from_rect3d()

torch::Tensor generate_bbox2d_from_rect3d ( const torch::Tensor &  rect3d,
int  image_width,
int  image_height 
)

Generate 2D bounding boxes from projected 3D rectangle corners.

This function creates 2D bounding boxes from projected 3D corners using a simple and efficient min/max approach. It includes visibility checking to filter out objects that are not sufficiently visible in the frame.

Parameters
[in]rect3dTorch tensor containing projected 3D rectangle corners Shape: [num_cams, N, 8, 2] where:
  • num_cams: number of camera views
  • N: number of objects
  • 8: eight corners of the 3D bounding box
  • 2: x, y coordinates in image space
[in]image_widthWidth of the image frame (default: 1920)
[in]image_heightHeight of the image frame (default: 1080)
Returns
Torch tensor of 2D bounding boxes Shape: [num_cams, N, 4] where 4 represents [x, y, w, h]
  • x, y: top-left corner coordinates
  • w, h: width and height of the bounding box
  • Invalid boxes have negative width/height for filtering

◆ generate_bbox3d_on_camera_frames()

torch::Tensor generate_bbox3d_on_camera_frames ( const torch::Tensor &  bboxes3d,
const torch::Tensor &  projection_matrices 
)

Converts 3D bounding boxes from world coordinates to camera coordinates.

Projects 3D bounding boxes onto 2D camera frames.

Parameters
bboxes3dTorch tensor containing 3D bounding boxes in world coordinates
projection_matricesProjection matrices for transforming from world to camera coordinates
Returns
Torch tensor of projected 2D coordinates for each corner of each box

◆ test_generate_bbox3d_on_camera_frames()

void test_generate_bbox3d_on_camera_frames ( PrettyLogger *  logger)

Test function to generate bbox3d on camera frames.

Parameters
loggerLogger for debug and warning messages