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: the perspective transformation function of LDC module in VPAC in TDA4VM

Part Number: TDA4VM

Hi TI,

        we have some problems about TDA4VM  project, please help solve it, thanks!

        We are currently debugging the perspective transformation function of LDC module in VPAC in TDA4VM,SDK version is 7.0

        we also use the openvx interface of VxWarpPerspectiveNode function to verify the correctness of perspective transformation matrix, resulting in the perspective transformation matrix as follows:

         mat[0][0] =  2.1290272602462177e+00;

         mat[0][1] = -4.1308411668024979e-02;

         mat[0][2] = -8.2681922957050295e-05;

 

         mat[1][0] =  -7.6434047757225043e+00;

         mat[1][1] =  -4.6667823465474383e+00;

         mat[1][2] =  -1.1925750888519777e-02;

         mat[2][0] =  1.7556816975919139e+03;

         mat[2][1] =  1.5900504121366725e+03;

         mat[2][2] =  3.8293676632749518e+00;

         The original drawing we used is as follows:

         

         

         We do this by using the vxWarpPerspectiveNode function gets the following result, which gives us what we actually want:

         

         We place the original matrix inTivxVpacLdcNode too, the output results are as follows:

        

        It can see, tivxVpacLdcNode seems to be doing only half the perspective transformationAnd only the left and upper half are transformed.My registration process for LDC is as follows

       

        #define LDC_BLOCK_WIDTH     (8)
        #define LDC_BLOCK_HEIGHT    (8)
        #define LDC_PIXEL_PAD       (0)
        ldcObj->region_params.out_block_width   = LDC_BLOCK_WIDTH;
        ldcObj->region_params.out_block_height  = LDC_BLOCK_HEIGHT;
        ldcObj->region_params.pixel_pad         = LDC_PIXEL_PAD;
        ldcObj->region_config = vxCreateUserDataObject(context"tivx_vpac_ldc_region_params_t"sizeof(tivx_vpac_ldc_region_params_t),  NULL);
        vxCopyUserDataObject(ldcObj->region_config0,
                         sizeof(tivx_vpac_ldc_region_params_t),
                         &ldcObj->region_params,
                         VX_WRITE_ONLY,
                         VX_MEMORY_TYPE_HOST);
        
    tivx_vpac_ldc_params_init(&ldcObj->params);
    ldcObj->params.luma_interpolation_type = TIVX_VPAC_LDC_INTERPOLATION_BILINEAR;
    // ldcObj->params.dcc_camera_id = 0;
    ldcObj->config = vxCreateUserDataObject(context"tivx_vpac_ldc_params_t"sizeof(tivx_vpac_ldc_params_t), NULL);
    vxCopyUserDataObject(ldcObj->config0,
                         sizeof(tivx_vpac_ldc_params_t),
                         &ldcObj->params,
                         VX_WRITE_ONLY,
                         VX_MEMORY_TYPE_HOST);
     
     #define OUTPUT_DISPLAY_WIDTH        (640)
     #define OUTPUT_DISPLAY_HEIGHT       (872)
     ldcObj->output_width  = OUTPUT_DISPLAY_WIDTH;
     ldcObj->output_height = OUTPUT_DISPLAY_HEIGHT;
     
     vx_image output_img = vxCreateImage(contextldcObj->output_widthldcObj->output_heightimage_type);
     ldcObj->output_arr = vxCreateObjectArray(context, (vx_reference)output_img, 1);
    
      vx_float32 mat[3][3];  
      vx_float32 m_perspective[9];
   
      mat[0][0] =  2.1290272602462177e+00;
      mat[0][1] = -4.1308411668024979e-02;
      mat[0][2] = -8.2681922957050295e-05;

      mat[1][0] =  -7.6434047757225043e+00;
      mat[1][1] =  -4.6667823465474383e+00;
      mat[1][2] =  -1.1925750888519777e-02;

      mat[2][0] =  1.7556816975919139e+03;
      mat[2][1] =  1.5900504121366725e+03;
      mat[2][2] =  3.8293676632749518e+00;
    
      memcpy(m_perspectivematsizeof(mat));
     ldcObj->matrix_paramsvxCreateMatrix(context, VX_TYPE_FLOAT32, 33);
     if (vxGetStatus((vx_reference)ldcObj->matrix_params) == VX_SUCCESS)
     {
                if (VX_SUCCESS != vxCopyMatrix(matrix, m_perspective, VX_WRITE_ONLY, VX_MEMORY_TYPE_HOST))
                {
                    vxReleaseMatrix(&ldcObj->matrix_params);
                        APP_PRINTF("vxCreateMatrix failed!\n");
                    return 0;
                }
                APP_PRINTF("vxCreateMatrix success!\n");
      }

        app_init_ldc(obj->context
                    &obj->ldcObj
                    1280,
                    960,
                   VX_DF_IMAGE_NV12
                    NULL,
                    "ldc_obj",
                    0);
    
vx_image input_img = vxCreateImage(context,
                    INPUT_IMAGE_WIDTH,
                    INPUT_IMAGE_HEIGHT,
                    VX_DF_IMAGE_NV12);
   
vx_image output_img = (vx_image)vxGetObjectArrayItem(ldcObj->output_arr, 0);
     ldcObj->node = tivxVpacLdcNode(graphldcObj->configldcObj->matrix_params,
                                            ldcObj->region_configNULL,
                                            NULLNULLinput_img,
                                            output_imgNULL);
   // Program calling
          
         status = vxVerifyGraph(obj->graph);
          APP_ASSERT(status==VX_SUCCESS);
        
        app_load_vximage_from_file(obj->input_imginput_file_nameVX_DF_IMAGE_NV12);
        
        vxProcessGraph(obj->graph);
        
        
        app_save_vximage_to_file(output_file_name,output_img ,VX_DF_IMAGE_NV12);
    
  
        Please help me locate the cause of the problem, I'm looking forward to your reply, thanks!
Huicheng