Deepstream 5.0, why are NvOSD_RectParams left, top, width, height now floats?

• Hardware Platform (Jetson / GPU)
All of the above.
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version

I apologize if this has been asked and answered already, but is there any particular reason that the NvOSD_RectParams left, top, width, and height have been changed to floats? when the unit is still in pixels?


@rjhowell44 This change has been clarified in the release note

The bounding box coordinates are now in float data type. So when your network resolution is different to your frame resolution, you can get more precise bounding box coordinates.

1 Like

Just FYI, The change is mentioned in the release notes, but without an explanation… can you provide a little more information as to why a fraction of a pixel is useful to the on-screen display? This is an OSD structure, correct?

I’m just trying to understand as these values all need to be explicitly cast to ints now when mapping to OpenCV and other display or image coordinate structures that all use ints.

1 Like

@rjhowell44 It is not for displaying but for the bounding box coordination calculation precision.
For example, in the example of gst-dsexample, please refer to gstdsexample.cpp file, in gst_dsexample_transform_ip() implementation, the coordination is generated with DsExampleProcess() function with scaling of 1/8 or 1/2, and then in attach_metadata_full_frame(), the coordinates will be scaled with scale_ratio. Float data type has less accumulated error than integer data type.

1 Like

Hi Fiona,

Thanks for getting back to me. Yes, I’ve been looking through the example, and understand the new use case. Unfortunately, at lease for some of us, because this was an OSD type by name in the OSD Struct header file, and has display text and color params, we’ve derived new display data types using the Struct as a base… and as you can image, the move to floats makes the structure less than Ideal for this purpose. No worries, nothing that can’t be refactored.

Thanks again,