diff options
-rwxr-xr-x | scripts/v4l-cam.sh (renamed from test-cli/test/scripts/v4l-cam.sh) | 0 | ||||
-rw-r--r-- | test-cli/setup.xml | 5 | ||||
-rw-r--r-- | test-cli/test/helpers/camara.py | 5 | ||||
-rw-r--r-- | test-cli/test/tests/qvideo.py | 25 |
4 files changed, 20 insertions, 15 deletions
diff --git a/test-cli/test/scripts/v4l-cam.sh b/scripts/v4l-cam.sh index 18da1c0..18da1c0 100755 --- a/test-cli/test/scripts/v4l-cam.sh +++ b/scripts/v4l-cam.sh diff --git a/test-cli/setup.xml b/test-cli/setup.xml index ee9288c..7a9fcbb 100644 --- a/test-cli/setup.xml +++ b/test-cli/setup.xml @@ -20,6 +20,11 @@ mtd_device="/dev/mtd0" factory_password="betera" firmware_password="paterna" skipflash="0" /> + <qvideo sdl_driver="x11" sdl_display=":0" capture_size_w="1280" capture_size_h="1024" camdevice="video0" + cam_setupfile="/root/hwtest-files/board/scripts/v4l-cam.sh" + capture_discardframes="3" capture_framemean="3" capture_maxfailed="1" + RED_min_count="50000" BLUE_min_count="50000" GREEN_min_count="50000" + /> </setup> <usb> <usbdev MANUFACTURER="Linux 4.9.81+ ohci_hcd" PRODUCT="OHCI Host Controller" CLASS="09" VENDOR="1d6b" PRODID="0001" ignore="1"/> diff --git a/test-cli/test/helpers/camara.py b/test-cli/test/helpers/camara.py index bcb1df7..b23df74 100644 --- a/test-cli/test/helpers/camara.py +++ b/test-cli/test/helpers/camara.py @@ -17,7 +17,7 @@ class Camara(object): self.__device_name = device self.__w = width self.__h = height - self.__setupScriptPath = setup_script_path; + self.__setupScriptPath = setup_script_path def Close(self): if self.__device is not None: @@ -64,8 +64,7 @@ class Camara(object): def __configure(self): self.__w = self.__setCamVar(cv2.CAP_PROP_FRAME_WIDTH, self.__w) self.__h = self.__setCamVar(cv2.CAP_PROP_FRAME_HEIGHT, self.__h) - sh.bash(self.__setupScriptPath + '/test/scripts/v4l-cam.sh') - # sh.bash("../scripts/v4l-cam.sh") + sh.bash(self.__setupScriptPath) def __setCamVar(self, key, val): valold = cv2.VideoCapture.get(self.__device, key) diff --git a/test-cli/test/tests/qvideo.py b/test-cli/test/tests/qvideo.py index b4133b6..225940b 100644 --- a/test-cli/test/tests/qvideo.py +++ b/test-cli/test/tests/qvideo.py @@ -16,17 +16,20 @@ class Qvideo(unittest.TestCase): self.__xmlObj = varlist["xml"] self.__QVideoName = varlist.get('name', 'qvideo') self.__resultlist = [] - self.__Camara = Camara(setup_script_path=varlist['testPath']) - self.__SDL2_Test = SDL2_Test() - self.__SDL2_Test.Clear() + self.__w = int(varlist.get('capture_size_w', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_size_w", 1280))) + self.__h = int(varlist.get('capture_size_h', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_size_h", 720))) + self.__discard_frames_Count = int(varlist.get('capture_discardframes',self.__xmlObj.getKeyVal(self.__QVideoName, "capture_discardframes", 3))) + self.__frame_mean = int(varlist.get('capture_framemean', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_framemean", 3))) + self.__max_failed = int(varlist.get('capture_maxfailed', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_maxfailed", 1))) + self.__cam_setupscript = varlist.get('cam_setupfile', self.__xmlObj.getKeyVal(self.__QVideoName, "cam_setupfile", + "/root/hwtest-files/board/scripts/v4l-cam.sh")) + self.__sdl_display = varlist.get('sdl_display', self.__xmlObj.getKeyVal(self.__QVideoName, "sdl_display", ":0")) + self.__sdl_driver = varlist.get('sdl_driver', self.__xmlObj.getKeyVal(self.__QVideoName, "sdl_driver", "x11")) + self.__camdevice = varlist.get('camdevice', self.__xmlObj.getKeyVal(self.__QVideoName, "camdevice", "video0")) - def define_capture(self): - self.__Camara.setSize( - int(self.params.get('capture_size_w', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_size_w", 1280))), - int(self.params.get('capture_size_h', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_size_h", 720)))) - self.__discard_frames_Count = int(self.params.get('capture_discardframes', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_discardframes", 3))) - self.__frame_mean = int(self.params.get('capture_framemean', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_framemean", 3))) - self.__max_failed = int(self.params.get('capture_maxfailed', self.__xmlObj.getKeyVal(self.__QVideoName, "capture_maxfailed", 1))) + self.__Camara = Camara(setup_script_path=self.__cam_setupscript, device=self.__camdevice, width=self.__w, height=self.__h) + self.__SDL2_Test = SDL2_Test(driver=self.__sdl_driver, display=self.__sdl_display, w=self.__w, h=self.__h) + self.__SDL2_Test.Clear() def __drop_frames(self, frame_count): count = frame_count @@ -99,8 +102,6 @@ class Qvideo(unittest.TestCase): def execute(self): self.__resultlist = [] - # set image size - self.define_capture() # Open camara if not self.__Camara.Open(): self.fail('Error: USB camera not found') |