From af8945e88ebb15790151b4caec2a43f464ac9f8e Mon Sep 17 00:00:00 2001 From: cudawarped <12133430+cudawarped@users.noreply.github.com> Date: Wed, 25 Jun 2025 15:35:35 +0300 Subject: [PATCH 1/2] cudev: Add _shfl_down implementation for long long and unsigned long long for CUDA Tookit versions < 9.0 --- .../include/opencv2/cudev/warp/shuffle.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/cudev/include/opencv2/cudev/warp/shuffle.hpp b/modules/cudev/include/opencv2/cudev/warp/shuffle.hpp index 0de5351fff..3e3bbb55cf 100644 --- a/modules/cudev/include/opencv2/cudev/warp/shuffle.hpp +++ b/modules/cudev/include/opencv2/cudev/warp/shuffle.hpp @@ -334,12 +334,28 @@ __device__ __forceinline__ uint shfl_down(uint val, uint delta, int width = warp __device__ __forceinline__ signed long long shfl_down(signed long long val, uint delta, int width = warpSize) { +#if defined __CUDACC_VER_MAJOR__ < 9 + union { long long ll; int2 i2; } u; + u.ll = val; + u.i2.x = __shfl_down(u.i2.x, delta, width); + u.i2.y = __shfl_down(u.i2.y, delta, width); + return u.ll; +#else return __shfl_down(val, delta, width); +#endif } __device__ __forceinline__ unsigned long long shfl_down(unsigned long long val, uint delta, int width = warpSize) { - return (unsigned long long) __shfl_down(val, delta, width); +#if defined __CUDACC_VER_MAJOR__ < 9 + union { unsigned long long ull; uint2 u2; } u; + u.ull = val; + u.u2.x = __shfl_down(static_cast(u.u2.x), delta, width); + u.u2.y = __shfl_down(static_cast(u.u2.y), delta, width); + return u.ull; +#else + return __shfl_down(val, delta, width); +#endif } __device__ __forceinline__ float shfl_down(float val, uint delta, int width = warpSize) From 084c769c9bf36d2cd488b3f2c18629e67b0c3d02 Mon Sep 17 00:00:00 2001 From: utibenkei Date: Wed, 20 Aug 2025 01:24:15 +0900 Subject: [PATCH 2/2] Add Java wrapper test for HoughPoint2Line in ximgproc module - Add basic functionality test for HoughPoint2Line in XimgprocTest.java - Add gen_dict.json to expose RO_STRICT and RO_IGNORE_BORDERS constants in Java wrapper - Implement minimal test to verify method call and output validity --- modules/ximgproc/misc/java/gen_dict.json | 10 +++++++++ .../ximgproc/misc/java/test/XimgprocTest.java | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 modules/ximgproc/misc/java/gen_dict.json create mode 100644 modules/ximgproc/misc/java/test/XimgprocTest.java diff --git a/modules/ximgproc/misc/java/gen_dict.json b/modules/ximgproc/misc/java/gen_dict.json new file mode 100644 index 0000000000..4ae9277df2 --- /dev/null +++ b/modules/ximgproc/misc/java/gen_dict.json @@ -0,0 +1,10 @@ +{ + "missing_consts": { + "Ximgproc": { + "public": [ + ["RO_STRICT", 0], + ["RO_IGNORE_BORDERS", 1] + ] + } + } +} diff --git a/modules/ximgproc/misc/java/test/XimgprocTest.java b/modules/ximgproc/misc/java/test/XimgprocTest.java new file mode 100644 index 0000000000..6b987b0a2f --- /dev/null +++ b/modules/ximgproc/misc/java/test/XimgprocTest.java @@ -0,0 +1,21 @@ +package org.opencv.test.ximgproc; + +import org.opencv.core.Core; +import org.opencv.core.CvType; +import org.opencv.core.Mat; +import org.opencv.core.Point; +import org.opencv.test.OpenCVTestCase; +import org.opencv.ximgproc.Ximgproc; + +public class XimgprocTest extends OpenCVTestCase { + + public void testHoughPoint2Line() { + Mat src = new Mat(80, 80, CvType.CV_8UC1, new org.opencv.core.Scalar(0)); + Point houghPoint = new Point(40, 40); + + int[] result = Ximgproc.HoughPoint2Line(houghPoint, src, Ximgproc.ARO_315_135, Ximgproc.HDO_DESKEW, Ximgproc.RO_IGNORE_BORDERS); + + assertNotNull(result); + assertEquals(4, result.length); + } +}