Ejemplo n.º 1
0
class HumanDetectionTests(unittest.TestCase):

    def setUp(self):
        rospack = rospkg.RosPack()
        self.pkgDir = rospack.get_path('rapp_testing_tools')

        self.ch = RappPlatformAPI()

    def test_humanDetectionTest(self):
        image = path.join(self.pkgDir, 'test_data',
            'human_detection_samples', 'NAO_picture_3.png')

        valid_humans = [{
            'up_left_point': {'y': 30.0, 'x': 48.0},
            'down_right_point': {'y': 399.0, 'x': 232.0}
        }]

        response = self.ch.humanDetection(image)

        self.assertEqual(response['error'], u'')
        self.assertEqual(response['humans'], valid_humans)

    def test_humanDetectionTest_wrongPath(self):
        image = path.join(self.pkgDir, '',
            'human_detection_samples', 'NAO_picture_3.png')
        response = self.ch.humanDetection(image)

        self.assertNotEqual(response['error'], u'')

    def test_humanDetectionTest_wrongPathType(self):
        image = 3
        response = self.ch.humanDetection(image)

        self.assertNotEqual(response['error'], u'')
Ejemplo n.º 2
0
    def RappHumanDetection(self, imageString, image):

        path = imageORimageString(imageString, image)  #path of saved image.
        ch = RappPlatformAPI(address=addr)
        response = ch.humanDetection(
            path)  # Use the server's path of the image.
        return response
Ejemplo n.º 3
0
class HumanDetectionTests(unittest.TestCase):
    def setUp(self):
        rospack = rospkg.RosPack()
        self.pkgDir = rospack.get_path('rapp_testing_tools')

        self.ch = RappPlatformAPI()

    def test_humanDetectionTest(self):
        image = path.join(self.pkgDir, 'test_data', 'human_detection_samples',
                          'NAO_picture_3.png')

        valid_humans = [{
            'up_left_point': {
                'y': 30.0,
                'x': 48.0
            },
            'down_right_point': {
                'y': 399.0,
                'x': 232.0
            }
        }]

        response = self.ch.humanDetection(image)

        self.assertEqual(response['error'], u'')
        self.assertEqual(response['humans'], valid_humans)

    def test_humanDetectionTest_wrongPath(self):
        image = path.join(self.pkgDir, '', 'human_detection_samples',
                          'NAO_picture_3.png')
        response = self.ch.humanDetection(image)

        self.assertNotEqual(response['error'], u'')

    def test_humanDetectionTest_wrongPathType(self):
        image = 3
        response = self.ch.humanDetection(image)

        self.assertNotEqual(response['error'], u'')