draw_rect

savant.deepstream.opencv_utils.draw_rect(frame, rect, color, thickness=1, stream=None)

Draw rectangle on a frame.

Usage example:

with nvds_to_gpu_mat(gst_buffer, nvds_frame_meta) as frame_mat:
    draw_rect(frame_mat, (400, 100, 500, 300), (255, 0, 0, 255), 4)
Parameters:
  • frame (cv2.cuda.GpuMat) – The frame.

  • rect (Tuple[int, int, int, int]) – Rectangle coordinates (left, top, right, bottom).

  • color (Tuple[int, int, int, int]) – Border color (R, G, B, A).

  • thickness (int) – Border thickness.

  • stream (Optional[cv2.cuda.Stream]) – CUDA stream.