opencv_contrib-4.10.0-CUDA-12.6-tuple_size.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. https://github.com/opencv/opencv_contrib/pull/3785
  2. From 09eb618804588f77026924096d848800630c8d6f Mon Sep 17 00:00:00 2001
  3. From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
  4. Date: Tue, 3 Sep 2024 13:47:48 +0300
  5. Subject: [PATCH] Workaround for CUDA 12.6 tuple_size issue #3773.
  6. ---
  7. modules/cudaarithm/src/cuda/polar_cart.cu | 20 +++++---------------
  8. 1 file changed, 5 insertions(+), 15 deletions(-)
  9. diff --git a/modules/cudaarithm/src/cuda/polar_cart.cu b/modules/cudaarithm/src/cuda/polar_cart.cu
  10. index 725f5741d8..c65b894bf6 100644
  11. --- a/modules/cudaarithm/src/cuda/polar_cart.cu
  12. +++ b/modules/cudaarithm/src/cuda/polar_cart.cu
  13. @@ -159,25 +159,15 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _mag, OutputArray _angle,
  14. GpuMat_<float> magc(mag);
  15. GpuMat_<float> anglec(angle);
  16. + gridTransformUnary(globPtr<float2>(xy), globPtr<float>(magc), magnitude_interleaved_func<float2>(), stream);
  17. +
  18. if (angleInDegrees)
  19. {
  20. - auto f1 = magnitude_interleaved_func<float2>();
  21. - auto f2 = direction_interleaved_func<float2, true>();
  22. - cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
  23. - gridTransformTuple(globPtr<float2>(xy),
  24. - tie(magc, anglec),
  25. - f12,
  26. - stream);
  27. + gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, true>(), stream);
  28. }
  29. else
  30. {
  31. - auto f1 = magnitude_interleaved_func<float2>();
  32. - auto f2 = direction_interleaved_func<float2, false>();
  33. - cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
  34. - gridTransformTuple(globPtr<float2>(xy),
  35. - tie(magc, anglec),
  36. - f12,
  37. - stream);
  38. + gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, false>(), stream);
  39. }
  40. syncOutput(mag, _mag, stream);
  41. @@ -191,7 +181,7 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _magAngle, bool angleInDe
  42. CV_Assert( xy.type() == CV_32FC2 );
  43. GpuMat magAngle = getOutputMat(_magAngle, xy.size(), CV_32FC2, stream);
  44. -
  45. +
  46. if (angleInDegrees)
  47. {
  48. gridTransformUnary(globPtr<float2>(xy),