Hi,
I want to use nvxuSemiGlobalMatching
on custom image buffers. Therefore I mapped the buffers to an vx_image
using the vxCreateImageFromHandle
function:
vx_imagepatch_addressing_t addrLeft[1];
addrLeft[0].dim_x = width;
addrLeft[0].dim_y = height;
addrLeft[0].stride_x = sizeof(uint8_t);
addrLeft[0].stride_y = width*sizeof(uint8_t);
vx_imagepatch_addressing_t addrRight[1];
addrRight[0].dim_x = width;
addrRight[0].dim_y = height;
addrRight[0].stride_x = sizeof(uint8_t);
addrRight[0].stride_y = width*sizeof(uint8_t);
vx_imagepatch_addressing_t addrDisp[1];
addrDisp[0].dim_x = width;
addrDisp[0].dim_y = height;
addrDisp[0].stride_x = sizeof(int16_t);
addrDisp[0].stride_y = width*sizeof(int16_t);
// dataLeft, dataRight, dataDisp are pointers to allocated cuda memory
void *ptrsLeft[1] = { dataLeft };
void *ptrsRight[1] = { dataRight };
void *ptrsDisp[1] = { dataDisp };
auto vxImageLeft = vxCreateImageFromHandle(context, VX_DF_IMAGE_U8, addrLeft, ptrsLeft, NVX_MEMORY_TYPE_CUDA);
auto vxImageRight = vxCreateImageFromHandle(context, VX_DF_IMAGE_U8, addrRight, ptrsRight, NVX_MEMORY_TYPE_CUDA);
auto vxDisparity = vxCreateImageFromHandle(context, VX_DF_IMAGE_S16, addrDisp, ptrsDisp, NVX_MEMORY_TYPE_CUDA);
After that I call the nvxuSemiGlobalMatching
function using these images. Somehow the output in vxDisparity
is rubbish.
The weird thing is that when I create a temporary vxDisparityTemp
, pass that image to nvxuSemiGlobalMatching
and then copy that image using nvxuCopyImage
to vxDisparity
, the result looks good.
What could be the reason for that? Why can nvxuCopyImage
write into vxDisparity
and nvxuSemiGlobalMatching
not? Do I miss something?
Thanks,
Markus