apply_cuda_filter

savant.deepstream.opencv_utils.apply_cuda_filter(cuda_filter, frame, roi, stream=None)

Apply CUDA filter to a frame in place.

Usage example:

gaussian_filter = cv2.cuda.createGaussianFilter(
    cv2.CV_8UC4, cv2.CV_8UC4, (31, 31), 100, 100
)
with nvds_to_gpu_mat(gst_buffer, nvds_frame_meta) as frame_mat:
    # Blur specified area of the frame with gaussian blur
    apply_cuda_filter(gaussian_filter, frame_mat, (300, 400, 100, 200))
Parameters:
  • cuda_filter (cv2.cuda.Filter) – CUDA filter.

  • frame (cv2.cuda.GpuMat) – Frame to which apply CUDA filter.

  • roi (Tuple[int, int, int, int]) – Region of interest on the frame: (left, top, width, height).

  • stream (cv2.cuda.Stream | None) – CUDA stream.