Hi, I’ve been working with VRWorks360 sample programs and have had a lot of success using them to calibrate a dual fisheye 360 camera into an equirectangular projection that can then be used for perspective projections. I am trying to write my own perspective projection code modeled after the nvwarp360 sample, but I’m getting an unknown error when trying to perform the actual warp. The following code yields:
if((err = nvwarpWarpBuffer(nvwarp_han_, cu_stream_, cu_texture_, dst_buffer_,
cu_dst_row_bytes_)) != NVWARP_SUCCESS) {
std::cout << "Failed to warp buffer: " << nvwarpErrorStringFromCode(err)
<< std::endl;
}
“Failed to warp buffer: An otherwise unspecified error has been reported by the CUDA runtime”
The arguments were constructed, with no errors, as follows:
if((err = nvwarpWarpBuffer(nvwarp_han_, cu_stream_, cu_texture_, dst_buffer_,
cu_dst_row_bytes_)) != NVWARP_SUCCESS) {
std::cout << "Failed to warp buffer: " << nvwarpErrorStringFromCode(err)
<< std::endl;
}
...
src_res_desc.resType = cudaResourceTypePitch2D;
src_res_desc.res.pitch2D.devPtr = src_buffer_;
src_res_desc.res.pitch2D.desc = format_desc;
src_res_desc.res.pitch2D.width = src_img.cols;
src_res_desc.res.pitch2D.height = src_img.rows;
src_res_desc.res.pitch2D.pitchInBytes = cu_src_row_bytes_;
src_tex_desc.addressMode[0] = cudaAddressModeBorder;
src_tex_desc.addressMode[1] = cudaAddressModeBorder;
src_tex_desc.borderColor[0] = 0;
src_tex_desc.borderColor[1] = 0;
src_tex_desc.borderColor[2] = 0;
src_tex_desc.borderColor[3] = 0;
src_tex_desc.filterMode = cudaFilterModeLinear;
src_tex_desc.readMode = cudaReadModeNormalizedFloat;
src_tex_desc.normalizedCoords = false;
if (cudaCreateTextureObject(&cu_texture_, &src_res_desc, &src_tex_desc,
nullptr) != cudaSuccess) {
std::cout << "Failed create CUDA texture." << std::endl;
}
...
cu_dst_row_bytes_ = dst_width * sizeof(uint32_t);
if (cudaMallocPitch(&dst_buffer_, &cu_dst_row_bytes_, cu_dst_row_bytes_,
dst_height) != cudaSuccess) {
std::cout << "Failed to allocate destination buffer." << std::endl;
}
params_.type = NVWARP_EQUIRECT_PERSPECTIVE;
params_.srcHeight = src_img.rows;
params_.srcWidth = src_img.cols;
params_.dstHeight = dst_height;
params_.dstWidth = dst_width;
params_.srcX0 = (params_.srcWidth - 1) / 2.0;
params_.srcY0 = (params_.srcHeight - 1) / 2.0;
if (nvwarpComputeParamsSrcFocalLength(¶ms_, M_PI/2.0f, params_.srcHeight)
!= NVWARP_SUCCESS) {
std::cout << "Bad focal length." << std::endl;
}
params_.topAngle = 10.0 * M_PI / 180.0;
params_.bottomAngle = -10.0 * M_PI / 180.0
params_.rotAngles[1] = pitch;
params_.rotAngles[0] = yaw;
if (nvwarpSetParams(nvwarp_han_, ¶ms_) != NVWARP_SUCCESS) {
std::cout << "Failed to set warp parameters." << std::endl;
}