mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Improves a UMat unit test
This commit is contained in:
parent
dfa8467a08
commit
ee6415bd1c
@ -73,14 +73,17 @@ class UMat(NewOpenCVTests):
|
|||||||
|
|
||||||
_p1_mask_err = cv.calcOpticalFlowPyrLK(img1, img2, p0, None)
|
_p1_mask_err = cv.calcOpticalFlowPyrLK(img1, img2, p0, None)
|
||||||
|
|
||||||
_p1_mask_err_umat0 = map(cv.UMat.get, cv.calcOpticalFlowPyrLK(img1, img2, p0_umat, None))
|
_p1_mask_err_umat0 = list(map(lambda umat: umat.get(), cv.calcOpticalFlowPyrLK(img1, img2, p0_umat, None)))
|
||||||
_p1_mask_err_umat1 = map(cv.UMat.get, cv.calcOpticalFlowPyrLK(cv.UMat(img1), img2, p0_umat, None))
|
_p1_mask_err_umat1 = list(map(lambda umat: umat.get(), cv.calcOpticalFlowPyrLK(cv.UMat(img1), img2, p0_umat, None)))
|
||||||
_p1_mask_err_umat2 = map(cv.UMat.get, cv.calcOpticalFlowPyrLK(img1, cv.UMat(img2), p0_umat, None))
|
_p1_mask_err_umat2 = list(map(lambda umat: umat.get(), cv.calcOpticalFlowPyrLK(img1, cv.UMat(img2), p0_umat, None)))
|
||||||
|
|
||||||
# # results of OCL optical flow differs from CPU implementation, so result can not be easily compared
|
for _p1_mask_err_umat in [_p1_mask_err_umat0, _p1_mask_err_umat1, _p1_mask_err_umat2]:
|
||||||
# for p1_mask_err_umat in [p1_mask_err_umat0, p1_mask_err_umat1, p1_mask_err_umat2]:
|
for data, data_umat in zip(_p1_mask_err, _p1_mask_err_umat):
|
||||||
# for data, data_umat in zip(p1_mask_err, p1_mask_err_umat):
|
self.assertEqual(data.shape, data_umat.shape)
|
||||||
# self.assertTrue(np.allclose(data, data_umat))
|
self.assertEqual(data.dtype, data_umat.dtype)
|
||||||
|
for _p1_mask_err_umat in [_p1_mask_err_umat1, _p1_mask_err_umat2]:
|
||||||
|
for data_umat0, data_umat in zip(_p1_mask_err_umat0[:2], _p1_mask_err_umat[:2]):
|
||||||
|
self.assertTrue(np.allclose(data_umat0, data_umat))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
NewOpenCVTests.bootstrap()
|
NewOpenCVTests.bootstrap()
|
||||||
|
Loading…
Reference in New Issue
Block a user