Please provide complete information as applicable to your setup.
**• Hardware Platform (Jetson / GPU) GPU
**• DeepStream Version 6.2
• JetPack Version (valid for Jetson only)
**• TensorRT Version 8.5.22
**• NVIDIA GPU Driver Version (valid for GPU only)**525.85.12
**• Issue Type( questions, new requirements, bugs)**Draw more lines than deepstream pyds.NvOSD_LineParams object.
Good day, I want to draw regions on a image. I am using the pyds.NvOSD_LineParams object to draw a line. Below is code that can be used to replicate the use case:
def draw_regions_on_screan(pad, info):
line_params_index = 0
gst_buffer = info.get_buffer()
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
display_meta=pyds.nvds_acquire_display_meta_from_pool(batch_meta)
while l_emphasized textframe is not None:
try:
frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
except StopIteration:
ALPR_LOGGER.critical(f"l_frame is None")
# for key, region in region_detector.region_dict[frame_meta.pad_index].items():
display_meta.num_lines = region_detector.total_lines_dict[frame_meta.pad_index]
print(region_detector.region_dict[frame_meta.pad_index])
line_params = display_meta.line_params
regions = {'1': [[210, 69], [102, 107], [209, 139], [109, 179],
[233, 187], [140, 217], [240, 234], [96, 262],
[235, 348], [125, 380], [213, 399], [128, 430],
[225, 443], [320, 415], [282, 376], [310, 343],
[272, 287], [224, 279], [256, 232], [302, 246],
[352, 194], [313, 154], [265, 157], [254, 110],
[341, 124], [345, 193], [375, 227], [382, 328],
[385, 415], [446, 487], [619, 432], [716, 297],
[578, 197], [589, 100], [543, 38], [433, 141],
[486, 232], [453, 302], [422, 207], [370, 124],
[393, 76], [231, 39], [213, 65], [210, 69]]}
for key, region in regions.items():
try:
for index in range(len(region) - 1):
line_params[line_params_index].x1 = int(region[index][0])
line_params[line_params_index].y1 = int(region[index][1])
line_params[line_params_index].x2 = int(region[index+1][0])
line_params[line_params_index].y2 = int(region[index+1][1])
line_params[line_params_index].line_width = 3
line_params[line_params_index].line_color.set(0.0, 1.0, 0.0, 1.0) # Green color
line_params_index += 1
except Exception as e:
break
pyds.nvds_add_display_meta_to_frame(frame_meta, display_meta)
return Gst.PadProbeReturn.OK
This is a probe that is connected to the sink of the OSD plugin.
The ‘line_params’ is a list of objects that can be used to draw lines, but there is only 16 objects in that list, so I can not draw an unlimited number of lines on the screen. Is there a way for me to increase the number of objects in the ‘line_params’ list so that I can add the number of lines that I require (which varies from stream to stream)?
(The ‘regions’ variable that contains the dict of coordinates is only a example of what the values could be.)