VPIWrapMap can not be allocate

hello,
here is the code I allocate vpi map,
but vpiWarpMapAllocData return 2,
terminal shows:
what(): VPI_ERROR_INVALID_ARGUMENT: Number of horizontal regions must be between 1 and 4,

    VPIWarpMap map            = {};
    memset(&map, 0, sizeof(map));

    map.grid.numHorizRegions  = 1;
    map.grid.numVertRegions   = 1;

    map.grid.regionWidth[0]   = rec_width;  // 640
    map.grid.regionHeight[0]  = rec_height;  //480
    map.grid.horizInterval[0] = 1;
    map.grid.vertInterval[0]  = 1;
    printf("num region:%d\n", map.grid.numHorizRegions);
    CHECK_STATUS(vpiWarpMapAllocData(&map));

Hi,

We tested the below allocation and it can work as expected.

        VPIWarpMap map            = {};
        map.grid.numHorizRegions  = 1;
        map.grid.numVertRegions   = 1;
        map.grid.regionWidth[0]   = 640;
        map.grid.regionHeight[0]  = 480;
        map.grid.horizInterval[0] = 1;
        map.grid.vertInterval[0]  = 1;
        CHECK_STATUS(vpiWarpMapAllocData(&map));

Could you double-check the issue?
If the error still occurs, could you share a runnable sample with us?

Thanks.

Hi,
here is runnable sample
11-fisheye.zip (678.7 KB)

Hi,

Thanks for sharing the sample.

When we test this locally, the app looks for an input source to work.
Could you share the file with us as well?

$ ./vpi_sample_11_fisheye 
[ WARN:0@0.020] global loadsave.cpp:248 findDecoder imread_('/home/orin-nx/seeker_omni_dataset/left/frame0000.jpg'): can't open/read file: check file path/integrity
terminate called after throwing an instance of 'std::runtime_error'
  what():  Can't read /home/orin-nx/seeker_omni_dataset/left/frame0000.jpg
Aborted (core dumped)

Thanks.

image.zip (619.8 KB)

hi, here is image zip
by the way, i found fisheye recitfy is for mono not for stereo
then i rectify stereo with opencv
can remap use with VPI?

Thank you

Hi,

Thanks for sharing the image.
We will give it a try and provide more info to you.

You can run OpenCV’s algorithm to get the map and use VPI remap to warp the image.

Thanks.

Hi,

We try the same on VPI 3.2 of JetPack 6.2.
It can work correctly without errors.

Please also give it a try:

$ ./vpi_sample_11_fisheye 
in wrap opencv
in wrap opencv
map return type: 2
error occur
cam_matrix[0][0] : 1667.657593 
cam_matrix[0][1] : 0.000000 
cam_matrix[0][2] : 520.105225 
cam_matrix[1][0] : 0.000000 
cam_matrix[1][1] : 1655.588867 
cam_matrix[1][2] : 459.897186 
tran_matrix[0][0] : -0.001894 
tran_matrix[0][1] : -0.024520 
tran_matrix[0][2] : -0.999698 
tran_matrix[0][3] : -0.047487 
tran_matrix[1][0] : 0.002791 
tran_matrix[1][1] : 0.999695 
tran_matrix[1][2] : -0.024525 
tran_matrix[1][3] : -0.001042 
tran_matrix[2][0] : 0.999994 
tran_matrix[2][1] : -0.002836 
tran_matrix[2][2] : -0.001825 
tran_matrix[2][3] : -0.047252 
after fisheye dist : 1667.657593 
after fisheye dist : 1687.516602 
after fisheye dist : 0.000000 
after fisheye dist : 0.000000 
after fisheye dist : 520.105225 
after fisheye dist : 545.379517 
after fisheye dist : 0.000000 
after fisheye dist : 0.000000 
after fisheye dist : 1655.588867 
after fisheye dist : 1675.695435 
after fisheye dist : 459.897186 
after fisheye dist : 426.758575 
payload : 0
1
image size 2
2
3
4
5
remap status : 0 
7
8
2
3
4
5
remap status : 0 
7
8

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.