Page 1 of 1

Drawing Text or Strings on Camera Frames with RockRGA in rkipc

Posted: 2024-11-22 14:39
by pdoanthuannb96
I am currently modifying the rkipc app and working on adding the ability to draw text or strings on camera frames. There is a function in the app (path: video/video.c) that draws lines to create a bounding box:

Code: Select all

static int rga_nv12_border(rga_buffer_t buf, int x, int y, int width, int height, int line_pixel,
                           int color) {
	im_rect rect_up = {x, y, width, line_pixel};
	im_rect rect_buttom = {x, y + height - line_pixel, width, line_pixel};
	im_rect rect_left = {x, y, line_pixel, height};
	im_rect rect_right = {x + width - line_pixel, y, line_pixel, height};
	IM_STATUS STATUS = imfill(buf, rect_up, color);
	STATUS |= imfill(buf, rect_buttom, color);
	STATUS |= imfill(buf, rect_left, color);
	STATUS |= imfill(buf, rect_right, color);
	return STATUS == IM_STATUS_SUCCESS ? 0 : 1;
}
imfill function on rockrga:

Code: Select all

/*
 * fill/reset/draw
 *
 * @param src
 * @param dst
 * @param rect
 * @param color
 * @param sync
 *      wait until operation complete
 *
 * @returns success or else negative error code.
 */
#undef imfill
IM_API IM_STATUS imfill(rga_buffer_t dst, im_rect rect, int color, int sync = 1, int *release_fence_fd = NULL);
I want to use a similar approach to draw text or characters on the camera frame. Has anyone worked with RockRGA to render text or strings on the frame in a similar manner?
Thank you for your attention, and any information would be greatly appreciated!

Re: Drawing Text or Strings on Camera Frames with RockRGA in rkipc

Posted: 2024-11-25 1:49
by Crocodile
Hello, here is a guide to RGA development (unfortunately not available in English), which introduces how to call RGA OSD interface to add text to video stream