How to use 'remap' in VisionWorks?

Here is the usage I found about ‘remap’:

vx_context context = vxCreateContext();
vx_image src = vxCreateImage(context, 640, 480, VX_DF_IMAGE_RGBX);
vx_image dst = vxCreateImage(context, 640, 480, VX_DF_IMAGE_RGBX);
vx_remap map = vxCreateRemap(context, 640, 480, 640, 480);
vxuRemap(context, src, map, VX_INTERPOLATION_TYPE_NEAREST_NEIGHBOR, dst);

But I believe it is not complete. The ‘map’ object is not initialized properly.

Is there anyone who know that how to initialize the map object ?

1 Like

OK, I have figured it out. The vx_remap object ‘map’ should be initialized as following:

void SetRemapTable(cv::Mat map_x, cv::Mat map_y) {
    remap_table_ = vxCreateRemap(context_, map_x.cols, map_x.rows, map_x.cols, map_x.rows);
    for (int i=0; i<map_x.rows; i++) {
        for (int j=0; j<map_x.cols; j++) {
            vxSetRemapPoint(remap_table_, j, i,<float>(i, j),<float>(i, j));

The ‘map_x’ and ‘map_y’ are the map table used in cv::remap.

1 Like