Commit 7d4a2993 authored by WillBrennan's avatar WillBrennan

opencv in travis plus unit tests

parent 3f3df2d0
language: python language: python
dist: trusty
sudo: required
before_script: before_script:
- export PATH=/usr/bin:$PATH
- pip install -U pytest - pip install -U pytest
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -yq python-dev python-numpy python-opencv - sudo apt-get install -yq python-dev python-numpy python-opencv
- sudo ln /dev/null /dev/raw1394
- python -c "import cv2; print cv2.__version__" - python -c "import cv2; print cv2.__version__"
matrix: matrix:
include: include:
- python: "2.6" - python: "2.6"
- python: "2.7" - python: "2.7"
- python: "3.2" - python: "3.2"
......
...@@ -2,7 +2,7 @@ install: ...@@ -2,7 +2,7 @@ install:
pip install -r requirements.txt pip install -r requirements.txt
test: test:
pytest python -m pytest tests/
yapf: yapf:
find . -type f -name "*.py" | xargs yapf -i find . -type f -name "*.py" | xargs yapf -i
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'willbrennan'
# Built-in modules
# Standard modules
# Custom modules
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'willbrennan'
# Built-in modules
# Standard modules
# Custom modules
import cv2 import cv2
import os
import numpy import numpy
import skin_detector import skin_detector
def test_get_hsv_mask(): def test_get_hsv_mask():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
img = cv2.imread(img_path)
mask = skin_detector.get_hsv_mask(img) mask = skin_detector.get_hsv_mask(img)
assert img.shape[:2] == mask.shape assert img.shape[:2] == mask.shape
def test_get_rgb_mask(): def test_get_rgb_mask():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
img = cv2.imread(img_path)
mask = skin_detector.get_rgb_mask(img) mask = skin_detector.get_rgb_mask(img)
assert img.shape[:2] == mask.shape assert img.shape[:2] == mask.shape
def test_get_ycrcb_mask(): def test_get_ycrcb_mask():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
img = cv2.imread(img_path)
mask = skin_detector.get_ycrcb_mask(img) mask = skin_detector.get_ycrcb_mask(img)
assert img.shape[:2] == mask.shape assert img.shape[:2] == mask.shape
def test_grab_cut_mask(): def test_grab_cut_mask():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
img = cv2.imread(img_path)
assert True assert True
def test_closing(): def test_closing():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
img = cv2.imread(img_path)
assert True assert True
def test_process(): def test_process():
img = cv2.imread("../test_image.png") img_path = "tests/test_image.png"
assert True img = cv2.imread(img_path)
mask = skin_detector.process(img)
assert img.shape[:2] == mask.shape
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment