1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

feat: update NumPy type to Mat type fail message

Output string representation of NumPy array type if it is not
convertible to OpenCV Mat type
This commit is contained in:
Vadim Levin
2023-07-10 18:05:32 +03:00
parent fdc0c12b7f
commit 953de60ff0
3 changed files with 37 additions and 2 deletions
+8
View File
@@ -219,6 +219,14 @@ class Arguments(NewOpenCVTests):
#res6 = cv.utils.dumpInputArray([a, b])
#self.assertEqual(res6, "InputArrayOfArrays: empty()=false kind=0x00050000 flags=0x01050000 total(-1)=2 dims(-1)=1 size(-1)=2x1 type(0)=CV_32FC1 dims(0)=4 size(0)=[2 3 4 5]")
def test_unsupported_numpy_data_types_string_description(self):
for dtype in (object, str, np.complex128):
test_array = np.zeros((4, 4, 3), dtype=dtype)
msg = ".*type = {} is not supported".format(test_array.dtype)
self.assertRaisesRegex(
Exception, msg, cv.utils.dumpInputArray, test_array
)
def test_20968(self):
pixel = np.uint8([[[40, 50, 200]]])
_ = cv.cvtColor(pixel, cv.COLOR_RGB2BGR) # should not raise exception