NVIDIA DeepStream SDK API Reference

9.0 Release
sources/libs/nvll_osd/cuda/drawOBB.h File Reference

Detailed Description

Header for Oriented Bounding Box (OBB) rendering functions.

Provides GPU-accelerated rendering of rotated bounding boxes with support for:

  • Border rendering (configurable thickness)
  • Fill rendering
  • Combined border + fill
  • Opaque and alpha-blended variants

Definition in file sources/libs/nvll_osd/cuda/drawOBB.h.

Go to the source code of this file.

Functions

void drawOBB_border_cuda_unit_alpha (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, cudaStream_t stream, unsigned int r, unsigned int g, unsigned int b, int border_width)
 Draw OBB border with unit alpha (opaque, fast path) More...
 
void drawOBB_border_cuda (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, cudaStream_t stream, unsigned int r, unsigned int g, unsigned int b, float alpha, int border_width)
 Draw OBB border with alpha blending. More...
 
void drawOBB_fill_cuda_unit_alpha (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, unsigned int r, unsigned int g, unsigned int b, cudaStream_t stream)
 Fill OBB with solid color (unit alpha, fast path) More...
 
void drawOBB_fill_cuda (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, unsigned int r, unsigned int g, unsigned int b, float alpha, cudaStream_t stream)
 Fill OBB with alpha blending. More...
 
void drawOBB_combined_cuda_unit_alpha (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, cudaStream_t stream, unsigned int border_r, unsigned int border_g, unsigned int border_b, int border_width, unsigned int fill_r, unsigned int fill_g, unsigned int fill_b, bool is_filled)
 Draw OBB with both fill and border (unit alpha, fast path) More...
 
void drawOBB_combined_cuda (uint8_t *image, int width, int height, int pitch, float center_x, float center_y, float obb_width, float obb_height, float angle_rad, cudaStream_t stream, unsigned int border_r, unsigned int border_g, unsigned int border_b, float border_alpha, int border_width, unsigned int fill_r, unsigned int fill_g, unsigned int fill_b, float fill_alpha, bool is_filled)
 Draw OBB with both fill and border (with alpha blending) More...
 

Function Documentation

◆ drawOBB_border_cuda()

void drawOBB_border_cuda ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
cudaStream_t  stream,
unsigned int  r,
unsigned int  g,
unsigned int  b,
float  alpha,
int  border_width 
)

Draw OBB border with alpha blending.

Renders the border of a rotated bounding box with alpha blending. Slower than unit alpha variant due to read-modify-write operations.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
streamCUDA stream for async execution
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
alphaAlpha value (0.0-1.0)
border_widthBorder thickness in pixels
Note
Alpha blending formula: C_out = C_fg * α + C_bg * (1 - α)

◆ drawOBB_border_cuda_unit_alpha()

void drawOBB_border_cuda_unit_alpha ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
cudaStream_t  stream,
unsigned int  r,
unsigned int  g,
unsigned int  b,
int  border_width 
)

Draw OBB border with unit alpha (opaque, fast path)

Renders the border of a rotated bounding box without alpha blending. This is the fastest variant as it doesn't require reading background pixels.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
streamCUDA stream for async execution
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
border_widthBorder thickness in pixels
Note
Alpha is implicitly 1.0 (fully opaque)
Uses inverse rotation method for pixel-perfect rendering

◆ drawOBB_combined_cuda()

void drawOBB_combined_cuda ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
cudaStream_t  stream,
unsigned int  border_r,
unsigned int  border_g,
unsigned int  border_b,
float  border_alpha,
int  border_width,
unsigned int  fill_r,
unsigned int  fill_g,
unsigned int  fill_b,
float  fill_alpha,
bool  is_filled 
)

Draw OBB with both fill and border (with alpha blending)

Renders both fill and border with independent alpha values. Most flexible but slowest variant.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
streamCUDA stream for async execution
border_rBorder red component (0-255)
border_gBorder green component (0-255)
border_bBorder blue component (0-255)
border_alphaBorder alpha value (0.0-1.0)
border_widthBorder thickness in pixels
fill_rFill red component (0-255)
fill_gFill green component (0-255)
fill_bFill blue component (0-255)
fill_alphaFill alpha value (0.0-1.0)
is_filledWhether to render fill (true) or border only (false)
Note
Supports independent alpha for fill and border
Single-pass rendering with conditional blending

◆ drawOBB_combined_cuda_unit_alpha()

void drawOBB_combined_cuda_unit_alpha ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
cudaStream_t  stream,
unsigned int  border_r,
unsigned int  border_g,
unsigned int  border_b,
int  border_width,
unsigned int  fill_r,
unsigned int  fill_g,
unsigned int  fill_b,
bool  is_filled 
)

Draw OBB with both fill and border (unit alpha, fast path)

Renders both fill and border in a single pass without alpha blending. Most efficient for opaque OBBs.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
streamCUDA stream for async execution
border_rBorder red component (0-255)
border_gBorder green component (0-255)
border_bBorder blue component (0-255)
border_widthBorder thickness in pixels
fill_rFill red component (0-255)
fill_gFill green component (0-255)
fill_bFill blue component (0-255)
is_filledWhether to render fill (true) or border only (false)
Note
Both fill and border alpha are implicitly 1.0 (fully opaque)
Single-pass rendering for maximum efficiency

◆ drawOBB_fill_cuda()

void drawOBB_fill_cuda ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
unsigned int  r,
unsigned int  g,
unsigned int  b,
float  alpha,
cudaStream_t  stream 
)

Fill OBB with alpha blending.

Fills the interior of a rotated bounding box with alpha blending.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
alphaAlpha value (0.0-1.0)
streamCUDA stream for async execution

◆ drawOBB_fill_cuda_unit_alpha()

void drawOBB_fill_cuda_unit_alpha ( uint8_t *  image,
int  width,
int  height,
int  pitch,
float  center_x,
float  center_y,
float  obb_width,
float  obb_height,
float  angle_rad,
unsigned int  r,
unsigned int  g,
unsigned int  b,
cudaStream_t  stream 
)

Fill OBB with solid color (unit alpha, fast path)

Fills the interior of a rotated bounding box without alpha blending.

Parameters
imagePointer to RGBA image buffer (GPU memory)
widthImage width in pixels
heightImage height in pixels
pitchImage pitch in bytes (stride)
center_xOBB center X coordinate
center_yOBB center Y coordinate
obb_widthOBB width (before rotation)
obb_heightOBB height (before rotation)
angle_radRotation angle in radians
rRed component (0-255)
gGreen component (0-255)
bBlue component (0-255)
streamCUDA stream for async execution
Note
Alpha is implicitly 1.0 (fully opaque)