1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge pull request #27379 from cudawarped:fix_cuda_convertTo

cuda: Fix GpuMat::convertTo issues described in 27373 #27379

Fix https://github.com/opencv/opencv/issues/27373.

1. `GpuMat::convertTo` uses `convertToScale` due to incorrect overload.
2. There are no runtime checks to prevent the use of `CV_16U` data types in Release builds.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
cudawarped
2025-06-21 16:32:31 +03:00
committed by GitHub
parent 2ffca501e7
commit 1950c4dbb9
2 changed files with 11 additions and 2 deletions
+3 -1
View File
@@ -546,7 +546,7 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, int rtype, Stream& stream) co
return;
}
CV_DbgAssert( sdepth <= CV_64F && ddepth <= CV_64F );
CV_Assert( sdepth <= CV_64F && ddepth <= CV_64F );
GpuMat src = *this;
@@ -578,6 +578,8 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, int rtype, double alpha, doub
const int sdepth = depth();
const int ddepth = CV_MAT_DEPTH(rtype);
CV_Assert(sdepth <= CV_64F && ddepth <= CV_64F);
GpuMat src = *this;
_dst.create(size(), rtype);