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: Get super frame from cropped image

Part Number: TDA4VM

Hi TI expert:

The following figure shows the use case we are running. We get 1080p image from 2 cameras. We have to crop the 1080p images according to user command from outside. The cropped size is unknown in the initialization. In the A area, the two cropped image should be downscale or upscale to 720p images. After this step, the 2 720p images format a super frame and displayed in 2 separate displays.

My problem is that, how can I get the cropped buffer and do the upscale/downscale work in a running pipe line for the A area?

  • Hi,

    In your usecase, is the crop size known at the beginning of the application? i.e. Is the input taken from the user before the creation of the nodes?

    or Is the user trying to crop the image when the graph is running?

    Regards,
    Nikhil

  • Hi Nikhil Dasan:

    The crop size is not known at the beginning of the application. It is changed as the outside signal is changed when the graph is running.

    We get the input image by tivxCaptureNode() as the multi camera demo in vision_apps does.

  • Hi,

    You could use the crop functionality of the display node, in order to perform cropping during runtime.
    You could do something like below to crop with user inputs in the app_run_graph_interactive() function. The below is tested on the single cam demo.

    case 'c':
    obj->display_params.enableCropping = 1;
    obj->display_params.cropPrms.startX = obj->display_params.outWidth / 4;
    obj->display_params.cropPrms.startY = obj->display_params.outHeight / 4;
    obj->display_params.cropPrms.width = obj->display_params.outWidth/2;
    obj->display_params.cropPrms.height = obj->display_params.outHeight/2;

    obj->crop_obj = vxCreateUserDataObject(obj->context, "tivx_display_crop_params_t", sizeof(tivx_display_crop_params_t), NULL);

    vxCopyUserDataObject(obj->crop_obj, 0, sizeof(tivx_display_crop_params_t), &obj->display_params.cropPrms, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST);

    refs[0] = (vx_reference)obj->crop_obj;
    tivxNodeSendCommand(obj->displayNode, 0u, TIVX_DISPLAY_SET_CROP_PARAMS, refs, 1u);
    vxReleaseUserDataObject(&obj->crop_obj);

    break;

    Regards,
    Nikhil

  • Hi Nikhil Dasan:

    Thank you for your replay.

    This method I have tried several months ago. It can zoom in out zoom out in display. But now I have a split screen requirement, I have to get two 720P images before format a super frame and split the screen. I think TIVX_DISPLAY_SET_CROP_PARAMS can control the size for display, but how can I get the images in application?

  • Hi xiaogang liu,

    Can you please refer to the patch i shared on the below ticket? It shows how multiple display pipelines can be used to generate merged display.. 

    https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1095695/tda4vm-r5-touch-panel-drivers

    Regards,

    Brijesh

  • Hi Brijesh Jadav,Nikhil Dasan:

    Do you mean I can use crop operation(TIVX_DISPLAY_SET_CROP_PARAMS) after the super frame is splitted?

    I do not need to upscale or downscale the image before I generate the super frame. I just use two 720p images to create the super frame and display the splitted images. If the expected image zone is smaller than 720p, I can use TIVX_DISPLAY_SET_CROP_PARAMS, and the inner DSS module can crop(<720p) and do the scaler(<720p to 720p) automatically. Am I right?

    refs[0] = (vx_reference)obj->crop_obj;
    tivxNodeSendCommand(obj->displayNode, 0u, TIVX_DISPLAY_SET_CROP_PARAMS, refs, 1u);

  • Hi xiaogang liu,

    Do you mean I can use crop operation(TIVX_DISPLAY_SET_CROP_PARAMS) after the super frame is splitted?

    Super frame is sent out by the DSS and then Serializer splits this frame to drive multiple displays. This ioctl cannot be used after splitting of the frames, because this operation is out of DSS.

    You could crop the input 1080p frame to 720p in the DSS video pipeline and then merge them using overlay manager to create super frame..

    Regards,

    Brijesh 

  • Hi Brijesh Jadav:

    So I think I can not use TIVX_DISPLAY_SET_CROP_PARAMS to crop frame.

    I can use tivxVpacMscScaleNode to crop a input which is bigger than 720p to 720p output.

    My problem is in the pink zone of the following picture. If the required crop zone is smaller than 720p, how can I do the crop and upscaler?

  • Hi xiaogang,

    Upscaling cannot be done in the VPAC MSC scalar. This scalar supports only downscaling. 

    The only option for upscaling here is again DSS video pipeline. Video pipeline has inline scalar, so you could crop the input, by moving the start pointer and changing input size to smaller and then using inline scalar, you could upscale image to 720p. This is possible. But please note that depending on the input format, upscaling ratio is limited. 

    Regards,

    Brijesh

  • Hi Brijesh Jadav:

    My input format is YUV420.

    Is there any application interfaces to do the red string part?

    Video pipeline has inline scalar, so you could crop the input, by moving the start pointer and changing input size to smaller and then using inline scalar, you could upscale image to 720p

  • Hi Brijesh Jadav:

    Do you mean use TIVX_DISPLAY_SET_CROP_PARAMS tn the following reply? And the start pointer mean display_params.cropPrms.startX ?

    so you could crop the input, by moving the start pointer and changing input size to smaller

    case 'c':
    obj->display_params.enableCropping = 1;
    obj->display_params.cropPrms.startX = obj->display_params.outWidth / 4;
    obj->display_params.cropPrms.startY = obj->display_params.outHeight / 4;
    obj->display_params.cropPrms.width = obj->display_params.outWidth/2;
    obj->display_params.cropPrms.height = obj->display_params.outHeight/2;

    obj->crop_obj = vxCreateUserDataObject(obj->context, "tivx_display_crop_params_t", sizeof(tivx_display_crop_params_t), NULL);

    vxCopyUserDataObject(obj->crop_obj, 0, sizeof(tivx_display_crop_params_t), &obj->display_params.cropPrms, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST);

    refs[0] = (vx_reference)obj->crop_obj;
    tivxNodeSendCommand(obj->displayNode, 0u, TIVX_DISPLAY_SET_CROP_PARAMS, refs, 1u);

  • Hi xiaogang liu,

    Do you mean use TIVX_DISPLAY_SET_CROP_PARAMS tn the following reply? And the start pointer mean display_params.cropPrms.startX ?

    Yes, this ioctl supports cropping input image to small resolution. You could set the startX and startX to set the start offset and then cropPrms.width/height to set the cropped image size. 

    Also please make sure to enable cropping in the create params by setting enableCropping flag to true. 

    Regards,

    Brijesh

  • I see. Thank you very much.

    Close this issue.