def test_balance_contrast():
    tr = target_reader()
    tr.read_image(test_img)
    tr.remove_skew()
    tr.standardize_size()
    assert tr.balance_contrast() == None
    assert len(tr.stage_images) == 3
Beispiel #2
0
from target_reader import target_reader
from shot_stats import shot_stats

# Sets app config values
app = Flask(__name__)
app.config['ALLOWED_IMAGE_EXTENSIONS'] =\
    ['BMP', 'DIB', 'JPEG', 'JPG', 'JPE', 'JP2', 'PNG', 'WEBP', 'TIF', 'TIFF']
app.config['MAX_IMAGE_FILESIZE'] = 5 * 1024 * 1024

# Default image settings
img_rel = 'static/sample_targets'
img_dir = os.path.join(root_dir, 'flask', img_rel)
trg_size = 400

# Instantiates target reader and shot stats objects
tr = target_reader()
ss = shot_stats(trg_size, tr.score_step, tr.out_width)


@app.route("/", methods=["POST", "GET"])
def index():
    '''
    Gathers input from user and displays results using a Flask HTML template

    Args:
        None

    Returns:
        None
    '''
    if request.method == 'POST':
def test_target_reader():
    tr = target_reader()
    test_result = tr.run(test_img)
    assert test_result == None
    assert len(tr.stage_images) == 4
def test_remove_skew():
    tr = target_reader()
    tr.read_image(test_img)
    skew_removed = tr.remove_skew()
    assert skew_removed == None
    assert len(tr.stage_images) == 1
def test_read_image():
    tr = target_reader()
    assert tr.read_image(test_img) == None