Skip to content

Commit c35a833

Browse files
committed
Fixed typing with Numpy 2.4.x in tests.
1 parent a31042f commit c35a833

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

patches/patchNumpy24Types

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
diff --git a/modules/python/test/test_fitline.py b/modules/python/test/test_fitline.py
2+
index 2197f8db7f..3a04708a68 100644
3+
--- a/modules/python/test/test_fitline.py
4+
+++ b/modules/python/test/test_fitline.py
5+
@@ -55,7 +55,7 @@ class fitline_test(NewOpenCVTests):
6+
for name in dist_func_names:
7+
func = getattr(cv, name)
8+
vx, vy, cx, cy = cv.fitLine(np.float32(points), func, 0, 0.01, 0.01)
9+
- line = [float(vx), float(vy), float(cx), float(cy)]
10+
+ line = [vx[0], vy[0], cx[0], cy[0]]
11+
lines.append(line)
12+
13+
eps = 0.05
14+
diff --git a/modules/python/test/test_mser.py b/modules/python/test/test_mser.py
15+
index c76e9d4c79..596c82adb5 100644
16+
--- a/modules/python/test/test_mser.py
17+
+++ b/modules/python/test/test_mser.py
18+
@@ -8,6 +8,7 @@ from __future__ import print_function
19+
20+
import numpy as np
21+
import cv2 as cv
22+
+import random
23+
24+
from tests_common import NewOpenCVTests
25+
26+
@@ -31,19 +32,18 @@ class mser_test(NewOpenCVTests):
27+
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
28+
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
29+
]
30+
- thresharr = [ 0, 70, 120, 180, 255 ]
31+
kDelta = 5
32+
mserExtractor = cv.MSER_create()
33+
mserExtractor.setDelta(kDelta)
34+
- np.random.seed(10)
35+
+ random.seed(10)
36+
37+
for _i in range(100):
38+
39+
- use_big_image = int(np.random.rand(1,1)*7) != 0
40+
- invert = int(np.random.rand(1,1)*2) != 0
41+
- binarize = int(np.random.rand(1,1)*5) != 0 if use_big_image else False
42+
- blur = int(np.random.rand(1,1)*2) != 0
43+
- thresh = thresharr[int(np.random.rand(1,1)*5)]
44+
+ use_big_image = random.choice([True, False])
45+
+ invert = random.choice([True, False])
46+
+ binarize = random.choice([True, False]) if use_big_image else False
47+
+ blur = random.choice([True, False])
48+
+ thresh = random.choice([0, 70, 120, 180, 255])
49+
src0 = img if use_big_image else np.array(smallImg).astype('uint8')
50+
src = src0.copy()
51+

0 commit comments

Comments
 (0)