Right align NvOSD_TextParams

I’m writing some text on the screen using a NvOSD_TextParams txt_params structure.
when i left align it to something i can set:

txt_params->x_offset = obj_meta->rect_params.left;
txt_params->y_offset = obj_meta->rect_params.top;

however if i want to right align it then i need to do something like:

txt_params->x_offset = obj_meta->rect_params.left + obj_meta->rect_params.width - txt_params->width;

except that txt_params->width is not available.

is there a different way to right align the text ?

Please provide complete information as applicable to your setup.

β€’ Hardware Platform (Jetson / GPU)
β€’ DeepStream Version
β€’ JetPack Version (valid for Jetson only)
β€’ TensorRT Version
β€’ NVIDIA GPU Driver Version (valid for GPU only)
β€’ Issue Type( questions, new requirements, bugs)
β€’ How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
β€’ Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

This is just a question about the API onscreen display API NVIDIA DeepStream SDK API Reference: On-Screen Display API
but anyway here are the details. I hope it helps you with answering the question about the API.

Jetson nano
Deepstream 6.0
Jetpack: 4.6
Issue Type: question

so the question is how to right align text NVIDIA DeepStream SDK API Reference: _NvOSD_TextParams Struct Reference if i can’t ask for the width of the TextParam.

Can you share more on the requirement in your use case? Why it benefit your use case?

no problem.
i have 2 bits of text that i want to show if the inference detects something.
on the left of a persons face i want to show β€˜on phone’ and on the right β€˜facemask’ (detected)

like this

β”‚ on phone β”‚  β”‚   facemask    β”‚
β”‚       ,─'         '─.       β”‚
β”‚     ,'               `.     β”‚
β”‚    β•±                   β•²    β”‚
β”‚   ;                     :   β”‚
β”‚   ;     .        .      :   β”‚
β”‚  ;     ( )      ( )      :  β”‚
β”‚  β”‚      '        '       β”‚  β”‚
β”‚  β”‚           β”‚           β”‚  β”‚
β”‚  :           β”‚           ;  β”‚
β”‚   :          β–Ό          ;   β”‚
β”‚   :                     ;   β”‚
β”‚    β•²     ──┐   β”Œβ”€β”€β”€    β•±    β”‚
β”‚     β•²      β””β”€β”€β”€β”˜      β•±     β”‚
β”‚      `.             ,'      β”‚
β”‚        '─.       ,─'        β”‚
β”‚           `─────'           β”‚

and because the face changes inside the image, i would like to draw it inside the face-box and have it left aligned for one text and right aligned for the other text.

Seems you can achieve your target with currently design. Right? Right align is one better to have feature. Right?

my question was if it was possible, then you ask what my use case is.
why don’t you just answer the question instead of passive aggressive β€œRight"s”?

i know i can make an ugly solution with the current api, i was just expecting a bit more from nvidia and nvidia support, that is all.

I want to conform if the feature blocked you. I also want to know the use case to understand if it is one valueable feature we can add it in following DS release. Thanks for your sharing.

so to get back to the original question:
can you confirm that there currently is no way to find out either the width of the text ? or is there a different way to right align text ?

No. We do not provide such functions now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.