Beispiel #1
0
 def test_imageBoundingBox(self):
     '''Tests TODO 8'''
     minX, minY, maxX, maxY = blend.imageBoundingBox(
         self.testimage, self.rot_trans_transform)
     sol_minX,sol_minY,sol_maxX,sol_maxY = \
         int(5-9*np.sin(np.pi/4)),int(-5),int(5+9*np.sin(np.pi/4)),int(18*np.sin(np.pi/4)-5)
     self.assertAlmostEqual(
         minX,
         sol_minX,
         msg='Expected bounding box min x to be {} +/-1 but got {}.'.format(
             sol_minX, minX),
         delta=1.01,
     )
     self.assertAlmostEqual(
         maxY,
         sol_maxY,
         msg='Expected bounding box max y to be {} +/-1 but got {}.'.format(
             sol_maxY, maxY),
         delta=1.01,
     )
     self.assertAlmostEqual(
         maxX,
         sol_maxX,
         msg='Expected bounding box max x to be {} +/-1 but got {}.'.format(
             sol_maxX, maxX),
         delta=1.01,
     )
     self.assertAlmostEqual(
         minY,
         sol_minY,
         msg='Expected bounding box min y to be {} +/-1 but got {}.'.format(
             sol_minY, minY),
         delta=1.01,
     )
Beispiel #2
0
    def testImageBoundingBox1(self):
        img = np.zeros((101, 51, 4))
        M = np.eye(3)

        actual_result = blend.imageBoundingBox(img, M)
        expected_result = (0, 0, 50, 100)
        self.assertEqual(actual_result, expected_result)
Beispiel #3
0
    def testImageBoundingBox2(self):
        img = np.zeros((101, 51, 3))
        M = np.eye(3)
        M[0, 2] = 10

        actual_result = blend.imageBoundingBox(img, M)
        expected_result = (10, 0, 60, 100)
        self.assertEqual(actual_result, expected_result)