In [1]:
import sys
sys.path.append('../')
In [2]:
%load_ext autoreload
%autoreload 2
In [6]:
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
In [22]:
import numpy as np
from segmentboard.segmentboard import crop
def test_crop():
img_test = np.arange(20).reshape((4, 5))
assert (crop(img_test, 2, 5, 0, 2) == np.array([[2, 3, 4], [7, 8, 9]])).all()
In [13]:
img_test = np.arange(20).reshape((4, 5))
In [14]:
img_test
Out[14]:
In [15]:
crop(img_test, 2, 5, 0, 2)
Out[15]:
In [21]:
assert (crop(img_test, 2, 5, 0, 2) == np.array([[2, 3, 4], [7, 8, 9]])).all()
In [ ]:
In [33]:
from segmentboard.segmentboard import extract_cards
from utils.format import bgr2rgb
import cv2
def test_extract_cards():
board_img = bgr2rgb(cv2.imread('../tests/test_data/test_board.jpg'))
cards = extract_cards(board_img)
assert len(cards) == 12
In [34]:
test_extract_cards()
In [4]:
from segmentboard.segmentboard import extract_cards
from utils.format import bgr2rgb
import cv2
def test_extract_cards():
"""Simple test. Todo: add more tests"""
board_img = bgr2rgb(cv2.imread('../tests/test_data/test_board.jpg'))
cards = extract_cards(board_img)
assert len(cards) == 12
test_extract_cards()
In [36]:
test_extract_cards()
In [ ]:
In [ ]:
In [ ]:
In [ ]: