Finish Projective Inverse Warp algorithm

This commit is contained in:
Piv
2021-08-24 20:13:30 +09:30
parent b7917ec465
commit c164c9720a
2 changed files with 125 additions and 17 deletions

View File

@@ -42,6 +42,22 @@ class MyTestCase(unittest.TestCase):
self.assertEqual(coords[0, height - 1, width - 1, 1], height - 1)
self.assertEqual(coords[0, height - 1, width - 1, 2], 1)
def test_warp(self):
height = 1000
width = 2000
coords = warp.image_coordinate(1, height, width)
coords = tf.reshape(coords, [1, height * width, 3])
coords = tf.transpose(coords, [0, 2, 1])
# source image to sample from
img = tf.random.uniform([1, height, width, 3]) * 255
intrinsics = tf.constant([[[1, 0, 0], [0, 1, 0], [0, 0, 1]]], dtype=tf.float32)
disp = tf.random.uniform([1, height, width]) * 255
pose = tf.random.uniform([1, 6])
warp.projective_inverse_warp(img, disp, pose, intrinsics, coords)
if __name__ == '__main__':
unittest.main()