示例#1
0
 def test_setting_value_in_buffer(self):
     mat = Mat(rows=1, cols=2, dtype=CV_32FC3)
     array1 = mat.asarray()
     array1[0, 0, :] = [0, 1, 2]
     array2 = mat.asarray()
     assert np.array_equal(array2[0, 0, :], np.array([0, 1, 2]))
     del array1
     del array2
示例#2
0
 def test_asarray_float(self):
     mat = Mat(rows=1, cols=2, dtype=CV_32FC2)
     array = mat.asarray()
     assert array.dtype == np.float32
     assert array.shape == (1, 2, 2)
     del array
示例#3
0
 def test_asarray_uint(self):
     mat = Mat(rows=1, cols=2, dtype=CV_8UC3)
     array = mat.asarray()
     assert array.dtype == np.uint8
     assert array.shape == (1, 2, 3)