Hello,
I take this error in runtime. When i make project i am taking no error. Is it format error or something like that? VX_d_img_input_to_downscale is gpuMat format but createVXImageFromCVGpuMat is not working. How can i solve this problem? Thanks.
Error:
terminate called after throwing an instance of ‘cv::Exception’
what(): OpenCV(3.4.3) /usr/include/NVX/nvx_opencv_interop.hpp:327: error: (-215:Assertion failed) vxGetStatus((vx_reference)img) == VX_SUCCESS in function ‘createVXImageFromCVGpuMat’
Code:
cv::cvtColor(d_img_input_to_downscale, VX_d_img_input_to_downscale, cv::COLOR_RGB2RGBA);
vx_image VX_img_downscale = nvx_cv::createVXImageFromCVGpuMat(context,VX_d_img_input_to_downscale);
vx_image d_img_warped_vx = vxCreateImage(context, d_img_input_to_downscale.cols, d_img_input_current.rows , VX_DF_IMAGE_RGBX);
vx_matrix truncated = vxCreateMatrix(context, VX_TYPE_FLOAT32, 3, 3);
vxuWarpPerspective(context,VX_img_downscale,truncated,VX_INTERPOLATION_TYPE_BILINEAR,d_img_warped_vx);
nvx_cv::VXImageToCVMatMapper mapper(d_img_warped_vx,0,NULL,VX_READ_AND_WRITE,NVX_MEMORY_TYPE_CUDA);
cv::cuda::GpuMat d_img_warped = mapper.getGpuMat();
Hi,
Error -215 usually indicates an empty cvMat.
Please check your input image is valid first.
By the way, OpenCV GPU implementation is usually defined as cv::cuda::xxx.
It’s recommended to check if cv::cvtColor can take GPU memory as input first.
Thanks.
Sorry for code. I organize my code again but took same error.
Organized code:
cv::cuda::cvtColor(d_img_input_to_downscale, VX_d_img_input_to_downscale, cv::COLOR_RGB2RGBA);
vx_image VX_img_downscale = nvx_cv::createVXImageFromCVGpuMat(context,VX_d_img_input_to_downscale);
vx_image d_img_warped_vx = vxCreateImage(context,d_img_input_to_downscale.cols, d_img_input_to_downscale.rows , VX_DF_IMAGE_RGBX);
vx_matrix truncated = vxCreateMatrix(context, VX_TYPE_FLOAT32, 3, 3);
vxuWarpPerspective(context,VX_img_downscale,truncated,VX_INTERPOLATION_TYPE_BILINEAR,d_img_warped_vx);
nvx_cv::VXImageToCVMatMapper mapper(d_img_warped_vx,0,NULL,VX_READ_AND_WRITE,NVX_MEMORY_TYPE_CUDA);
cv::cuda::GpuMat d_img_warped = mapper.getGpuMat();
Something does not work in this line. The problem occurs in this line:
vx_image VX_img_downscale = nvx_cv::createVXImageFromCVGpuMat(context,VX_d_img_input_to_downscale);
Hi,
Suppose it should work with the usage like this:
cv::cuda::GpuMat d_src(src);
vx_image v_dsrc = nvx_cv::createVXImageFromCVGpuMat(context,d_src);
Do you meet any error with only the top-2 functions?
Thanks.
Thank you the reason of taking error is my cuda runtime version was wrong. I solved it there was no problem in code thank you for contributing.