-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Labels
bugcategory: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribconfirmedThere is stable reproducer / investigation completeThere is stable reproducer / investigation complete
Milestone
Description
System information (version)
- OpenCV => 4.3.0
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2019/NVCC
Detailed description
When uploading an Mat to a GpuMat called x, using cv::cuda::resize to downscale x into a new GpuMat called y, and finally flipping that image along the vertical axis by passing y as both the src and dst argument of cv::cuda::flip, major image fragmentation is produced on the right side of the y.
Here's a code example:
#include <opencv2/opencv.hpp>
#include <opencv2/cudaarithm.hpp>
#include <opencv2/cudawarping.hpp>
#include <iostream>
using namespace cv;
const int kDownscaleFactor = 3;
int main(int argc, char** argv) {
Mat image;
image = imread("img.jpg", IMREAD_COLOR);
cuda::GpuMat downscaled;
cuda::GpuMat flipped;
downscaled.upload(image);
cuda::resize(downscaled, flipped, Size(image.size[0] / kDownscaleFactor, image.size[1] / kDownscaleFactor));
cuda::flip(flipped, flipped, 1);
flipped.download(image);
namedWindow("Glitchy Image", WINDOW_AUTOSIZE);
imshow("Glitchy Image", image);
waitKey(0);
return 0;
}However, using a new GpuMat variable as the argument for the dst parameter of cv::cuda::flip (not the same one as src), this error is not produced.
Here is a zip file containing an executable demonstrating this error and the source code needed to reproduce it.
Steps to reproduce
- Upload a
Matobject to the GPU into aGpuMat x. - Downscale
xinto aGpuMat yby callingcv::cuda::resize(x, y, Size(...)); - Flip
yalong the vertical axis by callingcv::cuda::flip(y, y, 1);noting thatyis passed as both the source and destination matrix tocv::cuda::flip. - Calling
y.download(...)and displaying the results demonstrates significant image fragmentation.
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugcategory: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribconfirmedThere is stable reproducer / investigation completeThere is stable reproducer / investigation complete