This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: why i use the Draw2D_drawString to draw string, but no text display on the screen.

Part Number: TDA4VM

the main code is below.

            Draw2D_BufInfo sBufInfo;
            uint16_t *pDisplayBuf565;
            pDisplayBuf565 = tivxMemAlloc(DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t), TIVX_MEM_EXTERNAL);
            if (pDisplayBuf565 == NULL)
            {
                printf("app_tidl: ERROR: Unable to allocate memory for displayBuf565, size = %ld\n", DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t));
                status = -1;
            }

            if (obj->pHndl != NULL)
            {
                sBufInfo.bufWidth = DISPLAY_WIDTH;
                sBufInfo.bufHeight = DISPLAY_HEIGHT;
                sBufInfo.bufPitch[0] = DISPLAY_WIDTH * 2;
                sBufInfo.dataFormat = DRAW2D_DF_BGR16_565;
                sBufInfo.transperentColor = 0;
                sBufInfo.transperentColorFormat = DRAW2D_DF_BGR16_565;

                sBufInfo.bufAddr[0] = (uint8_t *)pDisplayBuf565;

                Draw2D_setBufInfo(obj->pHndl, &sBufInfo);
                // Draw2D_clearBuf(obj->pHndl);

                Draw2D_FontPrm sPoint;
                sPoint.fontIdx = 1;
                for (int i = 0; i < new_points0_size; i++)
                {
                    printf("corners %i, x: %i, y: %i\n", i, new_points0[i].x, new_points0[i].y);
                    // Draw2D_drawPixel(obj->pHndl, new_points0[i].x, new_points0[i].y, RGB888_TO_RGB565(255, 0, 0), DRAW2D_DF_BGR16_565);
                    Draw2D_drawString(obj->pHndl, 100, 100, "2", &sPoint);
                }
            }
            tivxMemFree(pDisplayBuf565 , DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t), TIVX_MEM_EXTERNAL);

pHndl is init in the init function, as below.

Draw2D_create(&obj->pHndl);
pHndl is defined in obj struct;
 
  • Hi,

    I think the buffer would have been filled with the proper text, but it needs to be used in the display in order to get it displayed. Where do you submit/use this buffer to the display driver? 

    Have you dumped/saved the buffer and confirmed that it is being writen with the test correctly? 

    Also why are you freeing the buffer space at the end? It should be submitted to the display node for the display.

    Please refer to any of the SRV/AVP demo to understand how text can be added to the display..

    Regards,

    Brijesh

  • i use the tivxDisplayNode function to display image, i have not found any api to put text on the vx image, so i use the 
    Draw2D_drawString to display in the screen, but it doesn't work, even i remove the "
    tivxMemFree(pDisplayBuf565 , DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t), TIVX_MEM_EXTERNAL);" part.
  • tivxDisplayNode

    This function just creates the node, its like a create function, but it can't display the directly. After graph verification, you would have to map the buffer and then update the contents into it and then enqueue the buffer for the actual display. 

    I would suggest to refer to one of the existing example to know how to display text image. There are many usecases in SRV, AVP demos to demonstrate text display.

  • i want to put the text on the image to show the keypoint's position extract from the image, but i don't find any use cases in SRV, AVP demos, i want to show the keypoints when process the images. thank you

  • Can you please check ti-processor-sdk-rtos-j721e-evm-07_03_00_07\vision_apps\apps\srv_demos\app_srv_camera\app_srv_camera.c? This example demonstrates how text could be displayed on GRPX window.