Hello,
“12_camera_v4l2_cuda” is being used to check the camera image.
I want to display text on the camera image.
Any reference?
Hello,
“12_camera_v4l2_cuda” is being used to check the camera image.
I want to display text on the camera image.
Any reference?
Hi,
Please try the functions in
/usr/src/jetson_multimedia_api/include/nvosd.h
You can call nvosd_put_text() to display text string.
Thank you for answer.
I used nvosd_put_text(), but the letter is not visible.
Attach the source used for testing.
camera_v4l2_cuda.cpp (26.7 KB)
camera_v4l2_cuda.h (3.6 KB)
I tried to express it in function start_capture(context_t * ctx).
set_text(ctx);
printf ("display_text %s\n", ctx->textParams.display_text);
nvosd_put_text(ctx->nvosd_context,
MODE_CPU,
ctx->render_dmabuf_fd,
1,
&ctx->textParams);
/* Preview */
ctx->renderer->render(ctx->render_dmabuf_fd);
Wrong use?
Hi,
There is sample code in
/usr/src/jetson_multimedia_api/samples/02_video_dec_cuda
Please take a look.
Hello
I confirmed 02_video_dec_cuda.
When displaying Text in the following sources, ABGR format is required.
if (ctx->enable_osd_text)
{
cout<<" Text overlay can only work with ABGR format, set converter capture plane to ABGR" <<endl;
ret = ctx->conv->setCapturePlaneFormat(V4L2_PIX_FMT_ABGR32,
crop.c.width,
crop.c.height,
V4L2_NV_BUFFER_LAYOUT_PITCH);
}
In 12_camera_v4l2_cuda it’s only YUV422 or YUV420.
Can this be applied here?
In 12_camera_v4l2_cuda, preview render is done by polling method.
02_video_dec_cuda uses NvVideoConverter to display text in conv0_capture_dqbuf_thread_callback function.
Can I refer to the source of applying NvVideoConverter to 12_camera_v4l2_cuda?
Hi,
You don’t need to use NvVideoConverter. Please call NvBufferTransform() to get RGBA NvBuffer and then call nvosd_create_context(), nvosd_put_text(), nvosd_destroy_context()
Hi,
I checked with the following code, but no characters were displayed.
/* Convert the camera buffer from YUV422 to YUV420P */
if (-1 == NvBufferTransform(ctx->g_buff[v4l2_buf.index].dmabuff_fd, ctx->render_dmabuf_fd,
&transParams))
ERROR_RETURN("Failed to convert the buffer");
{
ctx->nvosd_context = nvosd_create_context();
set_text(ctx);
nvosd_put_text(ctx->nvosd_context,
MODE_CPU,
ctx->render_dmabuf_fd,
1,
&ctx->textParams);
nvosd_destroy_context(ctx->nvosd_context);
ctx->nvosd_context = NULL;
}
camera_v4l2_cuda.h (3.2 KB)
camera_v4l2_cuda.cpp (20.2 KB)
How to get RGBA NvBuffer?
Is there any problem in displaying the screen with RGBA NvBuffer?
Hi,
ctx->render_dmabuf_fd is NvBufferColorFormat_YUV420 in default code. Please change it to NvBufferColorFormat_ABGR32
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.