I'm not sure how to specify the coordinates of a specific area (ROI) in deepstream-app.

I’m not sure how to specify the coordinates of a specific area (ROI) in deepstream-app.

  1. How do I specify the values of roi-top-offset and roi-bottom-offset, for example, to specify the following rectangles relative to the top left of the frame?

x1, y1 = 50, 50
x2, y2 = 500, 50
x3, y3 = 50, 700
x4, y4 = 500, 700

If the coordinates of the region of the ROI are like this
Is it correct to set roi-top-offset = (x1, y1), roi-bottom-offset = (x4, y4)?

  1. Is it possible to specify an ROI with multiple points (eg a polygon with more than 5 points)?

  2. And how can I display lines for a given ROI?

In order to set ROI for given frame you need to acquire display meta from displa_meta_pool. After this, fill “line_params” with line parameters defining the ROI. It is possible to set ROI with multiple points. deepstream-test1_app.c demonstrates how to acquire display meta. It shows how to fill text_params. On similar line you can set line params.

Thank you srathi.

I want to detect cars and people only within the area specified by ROI in live camera (rtsp). (Eg rectangular area)
If so, can I set the ROI using roi-top-offset and roi-bottom-offset?
If not, what is roi-top-offset and roi-bottom-offset used for?

I want to detect cars and people only within the area specified by ROI in live camera (rtsp). (Eg rectangular area)

This is not currently supported in nvinfer plugin but the sources have been open sourced so you can make the required changes.

Here’s the documentation for roi-top-offset and bottom-offset - https://docs.nvidia.com/metropolis/deepstream/4.0/dev-guide/index.html#page/DeepStream_Development_Guide%2Fdeepstream_app_config.3.3.html%23wwpID0EDHA

It’s similar to what you want to achieve but it does not define a rectangle but an offset from the top and bottom of the frame.