-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in cv::cuda::warpPerspective #2361
Comments
Same on 3.4 branch. |
Testing with CUDA8.0 and CUDA10.1, both cases seem to have this bug. GTX 1080 Ti |
I simplify example to: // main.cpp
#include <cstdlib>
#include <iostream>
#include <opencv2/cudawarping.hpp>
#include <vector>
int main() {
cv::Size inputSize{1, 1};
cv::Size outSize{1, 1};
// clang-format off
std::vector<float> values{
0, 0, 0,
0, 0, 2147483648, // XXX after converting to int we get -2147483648
};
// clang-format on
cv::Mat matrix{cv::Size{3, 2}, CV_32FC1, values.data()};
cv::cuda::GpuMat image{inputSize, CV_8UC1};
cv::cuda::GpuMat output;
cv::cuda::Stream stream;
cv::cuda::warpAffine(image, output, matrix, outSize,
cv::INTER_LINEAR | cv::WARP_INVERSE_MAP,
cv::BORDER_CONSTANT, cv::Scalar{0}, stream);
stream.waitForCompletion();
return EXIT_SUCCESS;
} Also I recompile opencv with nvcc flag
const int y1 = __float2int_rd(y); from device method of |
So, I think, problem in integer overflow. See on our transformation matrix - if we change our y-move value to |
Yes, problem is in integer overflow. Integer overflow is UB on cuda (like in c++ standard), so I just try change string that caused error from |
#2712 also not reproduced after previous fix |
Unfortunately I can't reproduce this error in some separate cuda function |
Affine transformation supports three types of interpolation: nearest, linear and cubic - but problem reproduce only with |
Hey !
|
@thilipwka please, see my previous comments. Currently you can't fix this problem, because problem is very deep in cuda code |
thank you |
I have the same problem cv::cuda::remap(inputGPU, inputGPU, M1Gpu, M2Gpu, cv::INTER_LINEAR); but it solved when I pass different gpu matrix for input and output cv::cuda::remap(inputGPU, outputGPU, M1Gpu, M2Gpu, cv::INTER_LINEAR); |
@andrejlevkovitch Is there some other way of doing a remap? A workaround? |
System information (version)
4.1.0
debian10
g++-8.3.0
cuda-10.1
Detailed description
With some matricies (perspective transformation) I get exception about illegal memory access in
GPU
memory:This happens only if I use not default stream and linear interpolation.
Steps to reproduce
Tested with
cuda-10.1
andopencv-4.1.0
.The text was updated successfully, but these errors were encountered: