Files
picar/tests/test_hand_recogniser.py
Michael Pivato 73f4297c5a Update tests.
2019-02-07 07:02:11 +10:30

30 lines
1.2 KiB
Python

import unittest
from GestureRecognition.simplehandrecogniser import SimpleHandRecogniser
import cv2
class TestSimpleHandRecogniser(unittest.TestCase):
def test_5_digits(self):
self.assertEqual(self.recogniser_5.get_gesture(), 5)
def test_3_digits(self):
self.assertEqual(self.recogniser_3.get_gesture(), 3)
def test_s_photo(self):
self.assertEqual(self.recogniser_s.get_gesture(), 5)
def setUp(self):
img_3 = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/IMG_0825.jpg")
img_3 = cv2.resize(img_3, None, fx=0.1, fy=0.1, interpolation = cv2.INTER_AREA)
self.recogniser_3 = SimpleHandRecogniser(img_3)
img_5 = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/IMG_0818.png")
img_5 = cv2.resize(img_5, None, fx=0.1, fy=0.1, interpolation = cv2.INTER_AREA)
self.recogniser_5 = SimpleHandRecogniser(img_5)
img_s = cv2.imread("/Users/piv/Documents/Projects/car/GestureRecognition/Screen Shot hand.png")
img_s = cv2.resize(img_s, None, fx=0.5, fy=0.5, interpolation = cv2.INTER_AREA)
self.recogniser_s = SimpleHandRecogniser(img_s)
if __name__ == '__main__':
unittest.main()