Add coordinates generation implementation

This commit is contained in:
Piv
2021-08-08 22:11:50 +09:30
parent ece37843ce
commit 8016f0f945
2 changed files with 43 additions and 2 deletions

View File

@@ -21,6 +21,24 @@ class MyTestCase(unittest.TestCase):
# TODO: Element-wise checks...
def test_coordinates(self):
height = 1000
width = 2000
coords = warp.image_coordinate(8, height, width)
self.assertEqual(coords.shape, [8, height, width, 3])
self.assertEqual(coords[0, 0, 0, 0], 0)
self.assertEqual(coords[0, 0, 0, 1], 0)
self.assertEqual(coords[0, 0, 0, 2], 1)
self.assertEqual(coords[0, height - 1, 0, 0], 0)
self.assertEqual(coords[0, height - 1, 0, 1], height - 1)
self.assertEqual(coords[0, height - 1, 0, 2], 1)
self.assertEqual(coords[0, height - 1, width - 1, 0], width - 1)
self.assertEqual(coords[0, height - 1, width - 1, 1], height - 1)
self.assertEqual(coords[0, height - 1, width - 1, 2], 1)
if __name__ == '__main__':
unittest.main()