Deepstream-rtsp-in-rtsp-out : counting of object in particular zone and Histrogram for visulization

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) nano
• DeepStream Version 7.0
• JetPack Version (valid for Jetson only) 6.0
• TensorRT Version 8.6.2.3-1+cuda12.2
• NVIDIA GPU Driver Version (valid for GPU only) NVIDIA-SMI 540.2.0
• Issue Type( questions, new requirements, bugs)

  1. How to create this kind of visulization ?

  2. is Gst-nvdsanalytics helpful to create those kind of visulization ?

  1. Is their any way to count the number of object in zone ?

  2. want to add histogram in below part :

def pgie_src_pad_buffer_probe(pad, info, u_data):
frame_number = 0
num_rects = 0
obj_counter = {
PGIE_CLASS_ID_PERSON: 0, # Initialize person count to 0
}

gst_buffer = info.get_buffer()
if not gst_buffer:
    print("Unable to get GstBuffer ")
    return

# Retrieve batch metadata from the gst_buffer
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list

while l_frame is not None:
    try:
        frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
    except StopIteration:
        break

    frame_number = frame_meta.frame_num
    num_rects = frame_meta.num_obj_meta  # Number of objects in the frame

    # Access the object metadata list
    l_obj = frame_meta.obj_meta_list
    while l_obj is not None:
        try:
            obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
        except StopIteration:
            break

        # Increment the counter for detected person objects
        if obj_meta.class_id == PGIE_CLASS_ID_PERSON:
            obj_counter[PGIE_CLASS_ID_PERSON] += 1

        # Set the border color of the object to blue
        obj_meta.rect_params.border_color.set(0.0, 0.0, 1.0, 0.8)

        try:
            l_obj = l_obj.next
        except StopIteration:
            break

    # Display person count and other metadata
    display_text = f"Frame Number={frame_number} Number of Objects={num_rects} Person_count={obj_counter[PGIE_CLASS_ID_PERSON]}"
    print(display_text)  # Optional: Print to console for debugging

    # Add text display to the frame (example, using pyds.NvOSD_TextParams)
    py_nvosd_text_params = pyds.NvOSD_TextParams()
    py_nvosd_text_params.display_text = display_text
    py_nvosd_text_params.x_offset = 10
    py_nvosd_text_params.y_offset = 12
    py_nvosd_text_params.font_params.font_color.set(1.0, 1.0, 1.0, 1.0)
    py_nvosd_text_params.font_params.font_size = 10
    py_nvosd_text_params.font_params.font_name = "Serif"
    py_nvosd_text_params.set_bg_clr = 1
    py_nvosd_text_params.text_bg_clr.set(0.0, 0.0, 0.0, 0.5)

    # (Optional) Display RTSP timestamp if available
    if ts_from_rtsp:
        ts = frame_meta.ntp_timestamp / 1000000000
        print("RTSP Timestamp:", datetime.datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))

    try:
        l_frame = l_frame.next
    except StopIteration:
        break

return Gst.PadProbeReturn.OK

please refer to nvanalytics explanation . the “Overcrowding Detection” functionality is helpful to get the people number in a ROI.

Thank you very much. Issue solved. Please close it.