关于drp库中dilate和erode结构元大小问题

工程师们好,

         想问下能不能更换drp库函数中的结构元大小,默认3*3的有点太小了,多进行几次的话时延有点长,还是说不能修改只能用opencv去实现了

  • 目前这两个库的参数是固定死的不能修改。只能多做几次,例如:

    void R_BCD_DRP_Dilate(uint32_t input_address, uint32_t output_address1, uint32_t output_address2, uint32_t input_width, uint32_t input_height, uint8_t times)

    {

       int32_t ret_val;

       uint32_t tile_no;

       uint8_t loop;

       if(times == 0)

       {

        return;

       }

    /**************************/

    /* Load DRP Library       */

    /*        +-------------+ */

    /* tile 0 |   Dilate    | */

    /*        +-------------+ */

    /* tile 1 |   Dilate    | */

    /*        +-------------+ */

    /* tile 2 |   Dilate    | */

    /*        +-------------+ */

    /* tile 3 |   Dilate    | */

    /*        +-------------+ */

    /* tile 4 |   Dilate    | */

    /*        +-------------+ */

    /* tile 5 |   Dilate    | */

    /*        +-------------+ */

    /**************************/

    PerformSetStartTime(TIME_DILATE_DL);

    ret_val = R_DK2_Load(&g_drp_lib_dilate[0],

    R_DK2_TILE_0 | R_DK2_TILE_1 | R_DK2_TILE_2 | R_DK2_TILE_3 | R_DK2_TILE_4 | R_DK2_TILE_5,

    R_DK2_TILE_PATTERN_1_1_1_1_1_1, NULL, &cb_drp_finish, &drp_lib_id[0]);

    //DRP_DRV_ASSERT(ret_val);

    /************************/

    /* Activate DRP Library */

    /************************/

    ret_val = R_DK2_Activate(drp_lib_id[TILE_0] | drp_lib_id[TILE_1] | drp_lib_id[TILE_2] |

    drp_lib_id[TILE_3] | drp_lib_id[TILE_4] | drp_lib_id[TILE_5], 0);

    //DRP_DRV_ASSERT(ret_val);

    /* Set end time of process(DL)*/

    PerformSetEndTime(TIME_DILATE_DL);

    /* Set start time of process*/

    PerformSetStartTime(TIME_DILATE_EXE);

    /***************************************/

    /* Set R_DK2_Start function parameters */

    /***************************************/

    for (loop =0; loop < times; loop++){

    for (tile_no = 0; tile_no < R_DK2_TILE_NUM; tile_no++)

    {

    if(loop == 0)

    {

    /* Set the address of buffer to be read/write by DRP */

    param_dilate[tile_no].src = input_address  + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    param_dilate[tile_no].dst = output_address1 + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    }

    else

    {

    if (loop%2 == 1)

    {

    /* Set the address of buffer to be read/write by DRP */

    param_dilate[tile_no].src = output_address1  + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    param_dilate[tile_no].dst = output_address2 + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    }

    else

    {

    /* Set the address of buffer to be read/write by DRP */

    param_dilate[tile_no].src = output_address2  + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    param_dilate[tile_no].dst = output_address1 + (input_width * (input_height / R_DK2_TILE_NUM)) * tile_no;

    }

    }

    /* Set Image size */

    param_dilate[tile_no].width  = (uint16_t)input_width;

    param_dilate[tile_no].height = (uint16_t)input_height / R_DK2_TILE_NUM;

    /* Set whether to perform top or bottom edge border processing. */

    param_dilate[tile_no].top    = (tile_no == TILE_0) ? 1 : 0;

    param_dilate[tile_no].bottom = (tile_no == TILE_5) ? 1 : 0;

    /* Initialize variables to be used in termination judgment of the DRP library */

    drp_lib_status[tile_no] = DRP_NOT_FINISH;

    /*********************/

    /* Start DRP Library */

    /*********************/

    ret_val = R_DK2_Start(drp_lib_id[tile_no], (void *)&param_dilate[tile_no], sizeof(r_drp_dilate_t));

    //DRP_DRV_ASSERT(ret_val);

    }

    /***************************************/

    /* Wait until DRP processing is finish */

    /***************************************/

    for (tile_no = 0; tile_no < R_DK2_TILE_NUM; tile_no++)

    {

    while (drp_lib_status[tile_no] == DRP_NOT_FINISH);

    }

    }

       /* Set end time of process */

       PerformSetEndTime(TIME_DILATE_EXE);

       /**********************/

       /* Unload DRP library */

       /**********************/

       ret_val = R_DK2_Unload(drp_lib_id[TILE_0] | drp_lib_id[TILE_1] | drp_lib_id[TILE_2] |

        drp_lib_id[TILE_3] | drp_lib_id[TILE_4] | drp_lib_id[TILE_5], &drp_lib_id[TILE_0]);

       //DRP_DRV_ASSERT(ret_val);

    }