Continuing the discussion from VPI CUDA,OpenCV Interoperablity:
With VPI version 3.2, I can’t seem to find the vpiImageCreateCUDAMemWrapper in documentation, does it still exist ? if not, how to create a VPIImage from an OpenCV GPU Mat.
Alternatively, I work with Deepstream, is there a better way to create a VPIImage from the NvBufSurface buffer
currently i’m doing this :
in_surface = (NvBufSurface *) in_map_info.data;
if (NvBufSurfaceMapEglImage(in_surface, 0) != 0) {
goto error;
}
#ifdef __aarch64__
CUresult status;
CUeglFrame in_eglFrame;
CUgraphicsResource pInResource;
pInResource = nullptr;
cudaFree(0);
status = cuGraphicsEGLRegisterImage(&pInResource, in_surface->surfaceList[0].mappedAddr.eglImage, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
status = cuGraphicsResourceGetMappedEglFrame(&in_eglFrame, pInResource, 0, 0);
status = cuCtxSynchronize();
img_gpu = new cv::cuda::GpuMat(in_eglFrame.height, in_eglFrame.width, CV_8UC4, in_eglFrame.frame.pPitch[0]);
#else
img_gpu = new cv::cuda::GpuMat(in_surface->surfaceList[0].height, in_surface->surfaceList[0].width, CV_8UC4, in_surface->surfaceList[0].dataPtr);
#endif
Thank you