mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge branch 4.x
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
"""Algorithm serialization test."""
|
||||
from __future__ import print_function
|
||||
import base64
|
||||
import json
|
||||
import tempfile
|
||||
import os
|
||||
import cv2 as cv
|
||||
@@ -109,5 +111,96 @@ class filestorage_io_test(NewOpenCVTests):
|
||||
def test_json(self):
|
||||
self.run_fs_test(".json")
|
||||
|
||||
def test_base64(self):
|
||||
fd, fname = tempfile.mkstemp(prefix="opencv_python_sample_filestorage_base64", suffix=".json")
|
||||
os.close(fd)
|
||||
np.random.seed(42)
|
||||
self.write_base64_json(fname)
|
||||
os.remove(fname)
|
||||
|
||||
@staticmethod
|
||||
def get_normal_2d_mat():
|
||||
rows = 10
|
||||
cols = 20
|
||||
cn = 3
|
||||
|
||||
image = np.zeros((rows, cols, cn), np.uint8)
|
||||
image[:] = (1, 2, 127)
|
||||
|
||||
for i in range(rows):
|
||||
for j in range(cols):
|
||||
image[i, j, 1] = (i + j) % 256
|
||||
|
||||
return image
|
||||
|
||||
@staticmethod
|
||||
def get_normal_nd_mat():
|
||||
shape = (2, 2, 1, 2)
|
||||
cn = 4
|
||||
|
||||
image = np.zeros(shape + (cn,), np.float64)
|
||||
image[:] = (0.888, 0.111, 0.666, 0.444)
|
||||
|
||||
return image
|
||||
|
||||
@staticmethod
|
||||
def get_empty_2d_mat():
|
||||
shape = (0, 0)
|
||||
cn = 1
|
||||
|
||||
image = np.zeros(shape + (cn,), np.uint8)
|
||||
|
||||
return image
|
||||
|
||||
@staticmethod
|
||||
def get_random_mat():
|
||||
rows = 8
|
||||
cols = 16
|
||||
cn = 1
|
||||
|
||||
image = np.random.rand(rows, cols, cn)
|
||||
|
||||
return image
|
||||
|
||||
@staticmethod
|
||||
def decode(data):
|
||||
# strip $base64$
|
||||
encoded = data[8:]
|
||||
|
||||
if len(encoded) == 0:
|
||||
return b''
|
||||
|
||||
# strip info about datatype and padding
|
||||
return base64.b64decode(encoded)[24:]
|
||||
|
||||
def write_base64_json(self, fname):
|
||||
fs = cv.FileStorage(fname, cv.FileStorage_WRITE_BASE64)
|
||||
|
||||
mats = {'normal_2d_mat': self.get_normal_2d_mat(),
|
||||
'normal_nd_mat': self.get_normal_nd_mat(),
|
||||
'empty_2d_mat': self.get_empty_2d_mat(),
|
||||
'random_mat': self.get_random_mat()}
|
||||
|
||||
for name, mat in mats.items():
|
||||
fs.write(name, mat)
|
||||
|
||||
fs.release()
|
||||
|
||||
data = {}
|
||||
with open(fname) as file:
|
||||
data = json.load(file)
|
||||
|
||||
for name, mat in mats.items():
|
||||
buffer = b''
|
||||
|
||||
if mat.size != 0:
|
||||
if hasattr(mat, 'tobytes'):
|
||||
buffer = mat.tobytes()
|
||||
else:
|
||||
buffer = mat.tostring()
|
||||
|
||||
self.assertEqual(buffer, self.decode(data[name]['data']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
|
||||
@@ -80,5 +80,52 @@ class houghcircles_test(NewOpenCVTests):
|
||||
self.assertLess(float(len(circles) - matches_counter) / len(circles), .75)
|
||||
|
||||
|
||||
def test_houghcircles_alt(self):
|
||||
|
||||
fn = "samples/data/board.jpg"
|
||||
|
||||
src = self.get_sample(fn, 1)
|
||||
img = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
|
||||
img = cv.medianBlur(img, 5)
|
||||
|
||||
circles = cv.HoughCircles(img, cv.HOUGH_GRADIENT_ALT, 1, 10, np.array([]), 300, 0.9, 1, 30)
|
||||
|
||||
self.assertEqual(circles.shape, (1, 18, 3))
|
||||
|
||||
circles = circles[0]
|
||||
|
||||
testCircles = [[38, 181, 17.6],
|
||||
[99.7, 166, 13.12],
|
||||
[142.7, 160, 13.52],
|
||||
[223.6, 110, 8.62],
|
||||
[79.1, 206.7, 8.62],
|
||||
[47.5, 351.6, 11.64],
|
||||
[189.5, 354.4, 11.64],
|
||||
[189.8, 298.9, 10.64],
|
||||
[189.5, 252.4, 14.62],
|
||||
[252.5, 393.4, 15.62],
|
||||
[602.9, 467.5, 11.42],
|
||||
[222, 210.4, 9.12],
|
||||
[263.1, 216.7, 9.12],
|
||||
[359.8, 222.6, 9.12],
|
||||
[518.9, 120.9, 9.12],
|
||||
[413.8, 113.4, 9.12],
|
||||
[489, 127.2, 9.12],
|
||||
[448.4, 121.3, 9.12],
|
||||
[384.6, 128.9, 8.62]]
|
||||
|
||||
matches_counter = 0
|
||||
|
||||
for i in range(len(testCircles)):
|
||||
for j in range(len(circles)):
|
||||
|
||||
tstCircle = circleApproximation(testCircles[i])
|
||||
circle = circleApproximation(circles[j])
|
||||
if convContoursIntersectiponRate(tstCircle, circle) > 0.6:
|
||||
matches_counter += 1
|
||||
|
||||
self.assertGreater(float(matches_counter) / len(testCircles), .5)
|
||||
self.assertLess(float(len(circles) - matches_counter) / len(circles), .75)
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
|
||||
@@ -20,8 +20,13 @@ class Hackathon244Tests(NewOpenCVTests):
|
||||
flag, ajpg = cv.imencode("img_q90.jpg", a, [cv.IMWRITE_JPEG_QUALITY, 90])
|
||||
self.assertEqual(flag, True)
|
||||
self.assertEqual(ajpg.dtype, np.uint8)
|
||||
self.assertGreater(ajpg.shape[0], 1)
|
||||
self.assertEqual(ajpg.shape[1], 1)
|
||||
self.assertTrue(isinstance(ajpg, np.ndarray), "imencode returned buffer of wrong type: {}".format(type(ajpg)))
|
||||
self.assertEqual(len(ajpg.shape), 1, "imencode returned buffer with wrong shape: {}".format(ajpg.shape))
|
||||
self.assertGreaterEqual(len(ajpg), 1, "imencode length of the returned buffer should be at least 1")
|
||||
self.assertLessEqual(
|
||||
len(ajpg), a.size,
|
||||
"imencode length of the returned buffer shouldn't exceed number of elements in original image"
|
||||
)
|
||||
|
||||
def test_projectPoints(self):
|
||||
objpt = np.float64([[1,2,3]])
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from tests_common import NewOpenCVTests
|
||||
|
||||
try:
|
||||
if sys.version_info[:2] < (3, 0):
|
||||
raise unittest.SkipTest('Python 2.x is not supported')
|
||||
|
||||
|
||||
class MatTest(NewOpenCVTests):
|
||||
|
||||
def test_mat_construct(self):
|
||||
data = np.random.random([10, 10, 3])
|
||||
|
||||
#print(np.ndarray.__dictoffset__) # 0
|
||||
#print(cv.Mat.__dictoffset__) # 88 (> 0)
|
||||
#print(cv.Mat) # <class cv2.Mat>
|
||||
#print(cv.Mat.__base__) # <class 'numpy.ndarray'>
|
||||
|
||||
mat_data0 = cv.Mat(data)
|
||||
assert isinstance(mat_data0, cv.Mat)
|
||||
assert isinstance(mat_data0, np.ndarray)
|
||||
self.assertEqual(mat_data0.wrap_channels, False)
|
||||
res0 = cv.utils.dumpInputArray(mat_data0)
|
||||
self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=300 dims(-1)=3 size(-1)=[10 10 3] type(-1)=CV_64FC1")
|
||||
|
||||
mat_data1 = cv.Mat(data, wrap_channels=True)
|
||||
assert isinstance(mat_data1, cv.Mat)
|
||||
assert isinstance(mat_data1, np.ndarray)
|
||||
self.assertEqual(mat_data1.wrap_channels, True)
|
||||
res1 = cv.utils.dumpInputArray(mat_data1)
|
||||
self.assertEqual(res1, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=100 dims(-1)=2 size(-1)=10x10 type(-1)=CV_64FC3")
|
||||
|
||||
mat_data2 = cv.Mat(mat_data1)
|
||||
assert isinstance(mat_data2, cv.Mat)
|
||||
assert isinstance(mat_data2, np.ndarray)
|
||||
self.assertEqual(mat_data2.wrap_channels, True) # fail if __array_finalize__ doesn't work
|
||||
res2 = cv.utils.dumpInputArray(mat_data2)
|
||||
self.assertEqual(res2, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=100 dims(-1)=2 size(-1)=10x10 type(-1)=CV_64FC3")
|
||||
|
||||
|
||||
def test_mat_construct_4d(self):
|
||||
data = np.random.random([5, 10, 10, 3])
|
||||
|
||||
mat_data0 = cv.Mat(data)
|
||||
assert isinstance(mat_data0, cv.Mat)
|
||||
assert isinstance(mat_data0, np.ndarray)
|
||||
self.assertEqual(mat_data0.wrap_channels, False)
|
||||
res0 = cv.utils.dumpInputArray(mat_data0)
|
||||
self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=1500 dims(-1)=4 size(-1)=[5 10 10 3] type(-1)=CV_64FC1")
|
||||
|
||||
mat_data1 = cv.Mat(data, wrap_channels=True)
|
||||
assert isinstance(mat_data1, cv.Mat)
|
||||
assert isinstance(mat_data1, np.ndarray)
|
||||
self.assertEqual(mat_data1.wrap_channels, True)
|
||||
res1 = cv.utils.dumpInputArray(mat_data1)
|
||||
self.assertEqual(res1, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=500 dims(-1)=3 size(-1)=[5 10 10] type(-1)=CV_64FC3")
|
||||
|
||||
mat_data2 = cv.Mat(mat_data1)
|
||||
assert isinstance(mat_data2, cv.Mat)
|
||||
assert isinstance(mat_data2, np.ndarray)
|
||||
self.assertEqual(mat_data2.wrap_channels, True) # __array_finalize__ doesn't work
|
||||
res2 = cv.utils.dumpInputArray(mat_data2)
|
||||
self.assertEqual(res2, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=500 dims(-1)=3 size(-1)=[5 10 10] type(-1)=CV_64FC3")
|
||||
|
||||
|
||||
def test_mat_wrap_channels_fail(self):
|
||||
data = np.random.random([2, 3, 4, 520])
|
||||
|
||||
mat_data0 = cv.Mat(data)
|
||||
assert isinstance(mat_data0, cv.Mat)
|
||||
assert isinstance(mat_data0, np.ndarray)
|
||||
self.assertEqual(mat_data0.wrap_channels, False)
|
||||
res0 = cv.utils.dumpInputArray(mat_data0)
|
||||
self.assertEqual(res0, "InputArray: empty()=false kind=0x00010000 flags=0x01010000 total(-1)=12480 dims(-1)=4 size(-1)=[2 3 4 520] type(-1)=CV_64FC1")
|
||||
|
||||
with self.assertRaises(cv.error):
|
||||
mat_data1 = cv.Mat(data, wrap_channels=True) # argument unable to wrap channels, too high (520 > CV_CN_MAX=512)
|
||||
res1 = cv.utils.dumpInputArray(mat_data1)
|
||||
print(mat_data1.__dict__)
|
||||
print(res1)
|
||||
|
||||
|
||||
def test_ufuncs(self):
|
||||
data = np.arange(10)
|
||||
mat_data = cv.Mat(data)
|
||||
mat_data2 = 2 * mat_data
|
||||
self.assertEqual(type(mat_data2), cv.Mat)
|
||||
np.testing.assert_equal(2 * data, 2 * mat_data)
|
||||
|
||||
|
||||
def test_comparison(self):
|
||||
# Undefined behavior, do NOT use that.
|
||||
# Behavior may be changed in the future
|
||||
|
||||
data = np.ones((10, 10, 3))
|
||||
mat_wrapped = cv.Mat(data, wrap_channels=True)
|
||||
mat_simple = cv.Mat(data)
|
||||
np.testing.assert_equal(mat_wrapped, mat_simple) # ???: wrap_channels is not checked for now
|
||||
np.testing.assert_equal(data, mat_simple)
|
||||
np.testing.assert_equal(data, mat_wrapped)
|
||||
|
||||
#self.assertEqual(mat_wrapped, mat_simple) # ???
|
||||
#self.assertTrue(mat_wrapped == mat_simple) # ???
|
||||
#self.assertTrue((mat_wrapped == mat_simple).all())
|
||||
|
||||
|
||||
except unittest.SkipTest as e:
|
||||
|
||||
message = str(e)
|
||||
|
||||
class TestSkip(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.skipTest('Skip tests: ' + message)
|
||||
|
||||
def test_skip():
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
NewOpenCVTests.bootstrap()
|
||||
@@ -4,6 +4,12 @@ from __future__ import print_function
|
||||
import ctypes
|
||||
from functools import partial
|
||||
from collections import namedtuple
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
from collections import Sequence
|
||||
else:
|
||||
from collections.abc import Sequence
|
||||
|
||||
import numpy as np
|
||||
import cv2 as cv
|
||||
@@ -464,6 +470,151 @@ class Arguments(NewOpenCVTests):
|
||||
with self.assertRaises((TypeError), msg=get_no_exception_msg(not_convertible)):
|
||||
_ = cv.utils.dumpRange(not_convertible)
|
||||
|
||||
def test_reserved_keywords_are_transformed(self):
|
||||
default_lambda_value = 2
|
||||
default_from_value = 3
|
||||
format_str = "arg={}, lambda={}, from={}"
|
||||
self.assertEqual(
|
||||
cv.utils.testReservedKeywordConversion(20), format_str.format(20, default_lambda_value, default_from_value)
|
||||
)
|
||||
self.assertEqual(
|
||||
cv.utils.testReservedKeywordConversion(10, lambda_=10), format_str.format(10, 10, default_from_value)
|
||||
)
|
||||
self.assertEqual(
|
||||
cv.utils.testReservedKeywordConversion(10, from_=10), format_str.format(10, default_lambda_value, 10)
|
||||
)
|
||||
self.assertEqual(
|
||||
cv.utils.testReservedKeywordConversion(20, lambda_=-4, from_=12), format_str.format(20, -4, 12)
|
||||
)
|
||||
|
||||
def test_parse_vector_int_convertible(self):
|
||||
np.random.seed(123098765)
|
||||
try_to_convert = partial(self._try_to_convert, cv.utils.dumpVectorOfInt)
|
||||
arr = np.random.randint(-20, 20, 40).astype(np.int32).reshape(10, 2, 2)
|
||||
int_min, int_max = get_limits(ctypes.c_int)
|
||||
for convertible in ((int_min, 1, 2, 3, int_max), [40, 50], tuple(),
|
||||
np.array([int_min, -10, 24, int_max], dtype=np.int32),
|
||||
np.array([10, 230, 12], dtype=np.uint8), arr[:, 0, 1],):
|
||||
expected = "[" + ", ".join(map(str, convertible)) + "]"
|
||||
actual = try_to_convert(convertible)
|
||||
self.assertEqual(expected, actual,
|
||||
msg=get_conversion_error_msg(convertible, expected, actual))
|
||||
|
||||
def test_parse_vector_int_not_convertible(self):
|
||||
np.random.seed(123098765)
|
||||
arr = np.random.randint(-20, 20, 40).astype(np.float).reshape(10, 2, 2)
|
||||
int_min, int_max = get_limits(ctypes.c_int)
|
||||
test_dict = {1: 2, 3: 10, 10: 20}
|
||||
for not_convertible in ((int_min, 1, 2.5, 3, int_max), [True, 50], 'test', test_dict,
|
||||
reversed([1, 2, 3]),
|
||||
np.array([int_min, -10, 24, [1, 2]], dtype=np.object),
|
||||
np.array([[1, 2], [3, 4]]), arr[:, 0, 1],):
|
||||
with self.assertRaises(TypeError, msg=get_no_exception_msg(not_convertible)):
|
||||
_ = cv.utils.dumpVectorOfInt(not_convertible)
|
||||
|
||||
def test_parse_vector_double_convertible(self):
|
||||
np.random.seed(1230965)
|
||||
try_to_convert = partial(self._try_to_convert, cv.utils.dumpVectorOfDouble)
|
||||
arr = np.random.randint(-20, 20, 40).astype(np.int32).reshape(10, 2, 2)
|
||||
for convertible in ((1, 2.12, 3.5), [40, 50], tuple(),
|
||||
np.array([-10, 24], dtype=np.int32),
|
||||
np.array([-12.5, 1.4], dtype=np.double),
|
||||
np.array([10, 230, 12], dtype=np.float), arr[:, 0, 1], ):
|
||||
expected = "[" + ", ".join(map(lambda v: "{:.2f}".format(v), convertible)) + "]"
|
||||
actual = try_to_convert(convertible)
|
||||
self.assertEqual(expected, actual,
|
||||
msg=get_conversion_error_msg(convertible, expected, actual))
|
||||
|
||||
def test_parse_vector_double_not_convertible(self):
|
||||
test_dict = {1: 2, 3: 10, 10: 20}
|
||||
for not_convertible in (('t', 'e', 's', 't'), [True, 50.55], 'test', test_dict,
|
||||
np.array([-10.1, 24.5, [1, 2]], dtype=np.object),
|
||||
np.array([[1, 2], [3, 4]]),):
|
||||
with self.assertRaises(TypeError, msg=get_no_exception_msg(not_convertible)):
|
||||
_ = cv.utils.dumpVectorOfDouble(not_convertible)
|
||||
|
||||
def test_parse_vector_rect_convertible(self):
|
||||
np.random.seed(1238765)
|
||||
try_to_convert = partial(self._try_to_convert, cv.utils.dumpVectorOfRect)
|
||||
arr_of_rect_int32 = np.random.randint(5, 20, 4 * 3).astype(np.int32).reshape(3, 4)
|
||||
arr_of_rect_cast = np.random.randint(10, 40, 4 * 5).astype(np.uint8).reshape(5, 4)
|
||||
for convertible in (((1, 2, 3, 4), (10, -20, 30, 10)), arr_of_rect_int32, arr_of_rect_cast,
|
||||
arr_of_rect_int32.astype(np.int8), [[5, 3, 1, 4]],
|
||||
((np.int8(4), np.uint8(10), np.int(32), np.int16(55)),)):
|
||||
expected = "[" + ", ".join(map(lambda v: "[x={}, y={}, w={}, h={}]".format(*v), convertible)) + "]"
|
||||
actual = try_to_convert(convertible)
|
||||
self.assertEqual(expected, actual,
|
||||
msg=get_conversion_error_msg(convertible, expected, actual))
|
||||
|
||||
def test_parse_vector_rect_not_convertible(self):
|
||||
np.random.seed(1238765)
|
||||
arr = np.random.randint(5, 20, 4 * 3).astype(np.float).reshape(3, 4)
|
||||
for not_convertible in (((1, 2, 3, 4), (10.5, -20, 30.1, 10)), arr,
|
||||
[[5, 3, 1, 4], []],
|
||||
((np.float(4), np.uint8(10), np.int(32), np.int16(55)),)):
|
||||
with self.assertRaises(TypeError, msg=get_no_exception_msg(not_convertible)):
|
||||
_ = cv.utils.dumpVectorOfRect(not_convertible)
|
||||
|
||||
def test_vector_general_return(self):
|
||||
expected_number_of_mats = 5
|
||||
expected_shape = (10, 10, 3)
|
||||
expected_type = np.uint8
|
||||
mats = cv.utils.generateVectorOfMat(5, 10, 10, cv.CV_8UC3)
|
||||
self.assertTrue(isinstance(mats, tuple),
|
||||
"Vector of Mats objects should be returned as tuple. Got: {}".format(type(mats)))
|
||||
self.assertEqual(len(mats), expected_number_of_mats, "Returned array has wrong length")
|
||||
for mat in mats:
|
||||
self.assertEqual(mat.shape, expected_shape, "Returned Mat has wrong shape")
|
||||
self.assertEqual(mat.dtype, expected_type, "Returned Mat has wrong elements type")
|
||||
empty_mats = cv.utils.generateVectorOfMat(0, 10, 10, cv.CV_32FC1)
|
||||
self.assertTrue(isinstance(empty_mats, tuple),
|
||||
"Empty vector should be returned as empty tuple. Got: {}".format(type(mats)))
|
||||
self.assertEqual(len(empty_mats), 0, "Vector of size 0 should be returned as tuple of length 0")
|
||||
|
||||
def test_vector_fast_return(self):
|
||||
expected_shape = (5, 4)
|
||||
rects = cv.utils.generateVectorOfRect(expected_shape[0])
|
||||
self.assertTrue(isinstance(rects, np.ndarray),
|
||||
"Vector of rectangles should be returned as numpy array. Got: {}".format(type(rects)))
|
||||
self.assertEqual(rects.dtype, np.int32, "Vector of rectangles has wrong elements type")
|
||||
self.assertEqual(rects.shape, expected_shape, "Vector of rectangles has wrong shape")
|
||||
empty_rects = cv.utils.generateVectorOfRect(0)
|
||||
self.assertTrue(isinstance(empty_rects, tuple),
|
||||
"Empty vector should be returned as empty tuple. Got: {}".format(type(empty_rects)))
|
||||
self.assertEqual(len(empty_rects), 0, "Vector of size 0 should be returned as tuple of length 0")
|
||||
|
||||
expected_shape = (10,)
|
||||
ints = cv.utils.generateVectorOfInt(expected_shape[0])
|
||||
self.assertTrue(isinstance(ints, np.ndarray),
|
||||
"Vector of integers should be returned as numpy array. Got: {}".format(type(ints)))
|
||||
self.assertEqual(ints.dtype, np.int32, "Vector of integers has wrong elements type")
|
||||
self.assertEqual(ints.shape, expected_shape, "Vector of integers has wrong shape.")
|
||||
|
||||
|
||||
class CanUsePurePythonModuleFunction(NewOpenCVTests):
|
||||
def test_can_get_ocv_version(self):
|
||||
import sys
|
||||
if sys.version_info[0] < 3:
|
||||
raise unittest.SkipTest('Python 2.x is not supported')
|
||||
|
||||
self.assertEqual(cv.misc.get_ocv_version(), cv.__version__,
|
||||
"Can't get package version using Python misc module")
|
||||
|
||||
def test_native_method_can_be_patched(self):
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
raise unittest.SkipTest('Python 2.x is not supported')
|
||||
|
||||
res = cv.utils.testOverwriteNativeMethod(10)
|
||||
self.assertTrue(isinstance(res, Sequence),
|
||||
msg="Overwritten method should return sequence. "
|
||||
"Got: {} of type {}".format(res, type(res)))
|
||||
self.assertSequenceEqual(res, (11, 10),
|
||||
msg="Failed to overwrite native method")
|
||||
res = cv.utils._native.testOverwriteNativeMethod(123)
|
||||
self.assertEqual(res, 123, msg="Failed to call native method implementation")
|
||||
|
||||
|
||||
class SamplesFindFile(NewOpenCVTests):
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import random
|
||||
import argparse
|
||||
|
||||
import numpy as np
|
||||
#sys.OpenCV_LOADER_DEBUG = True
|
||||
import cv2 as cv
|
||||
|
||||
# Python 3 moved urlopen to urllib.requests
|
||||
|
||||
Reference in New Issue
Block a user