Skip to content

cv::cuda::GpuMat.convertTo() seems not to support in-place, while cv::Mat does #13092

@chacha21

Description

@chacha21

Visual Studio 2017, Windows 7 64 bits, OpenCV 3.4.3
Cuda 10

the following code raises an exception :

  cv::cuda::GpuMat m(cv::Size(1280, 1024), CV_32FC1);
  cv::cuda::Stream stream;
  m.convertTo(m, CV_8UC1, 1, 0, stream);
  cv::cuda::threshold(m, m, 128, 255, cv::THRESH_BINARY, stream);

OpenCV(3.4.3) Error: Gpu API call (an illegal memory access was encountered) in
cv::cudev::grid_transform_detail::TransformDispatcher<true, Policy>::call, file
e:\opencv-3.4.3\opencv\sources\modules\cudev\include\opencv2\cudev\grid\detail/t
ransform.hpp, line 318

Using a second matrix as a destination for the convertTo() gets rid of the problem.

So it seems that convertTo() is no safe to use in-place with cuda::GpuMat, while the same code with cv::Mat would be ok.
Is it a bug or a missing documentation ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions