mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Typing fix in tests for modern Numpy
This commit is contained in:
@@ -8,6 +8,7 @@ from __future__ import print_function
|
||||
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
import random
|
||||
|
||||
from tests_common import NewOpenCVTests
|
||||
|
||||
@@ -31,19 +32,18 @@ class mser_test(NewOpenCVTests):
|
||||
[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],
|
||||
[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]
|
||||
]
|
||||
thresharr = [ 0, 70, 120, 180, 255 ]
|
||||
kDelta = 5
|
||||
mserExtractor = cv.MSER_create()
|
||||
mserExtractor.setDelta(kDelta)
|
||||
np.random.seed(10)
|
||||
random.seed(10)
|
||||
|
||||
for _i in range(100):
|
||||
|
||||
use_big_image = int(np.random.rand(1,1)*7) != 0
|
||||
invert = int(np.random.rand(1,1)*2) != 0
|
||||
binarize = int(np.random.rand(1,1)*5) != 0 if use_big_image else False
|
||||
blur = int(np.random.rand(1,1)*2) != 0
|
||||
thresh = thresharr[int(np.random.rand(1,1)*5)]
|
||||
use_big_image = random.choice([True, False])
|
||||
invert = random.choice([True, False])
|
||||
binarize = random.choice([True, False]) if use_big_image else False
|
||||
blur = random.choice([True, False])
|
||||
thresh = random.choice([0, 70, 120, 180, 255])
|
||||
src0 = img if use_big_image else np.array(smallImg).astype('uint8')
|
||||
src = src0.copy()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user