Exemple #1
0
def test_innv_gray_levels_tuuint8():
    with pytest.raises(TypeError):
        S3.innv_gray_levels(np.zeros((2, 2), dtype=np.float32))


# def test_innv_gray_levels_tuOk():
#     with pytest.raises
def test_invert_colors_manual():
    img_in = np.array([[[0, 255, 0], [0, 255, 0], [0, 255, 0]],
                       [[0, 255, 128], [0, 255, 128], [0, 255, 128]],
                       [[0, 128, 255], [0, 128, 255], [0, 128, 255]]])
    img_out = np.array([[[255, 0, 255], [255, 0, 255], [255, 0, 255]],
                        [[255, 0, 127], [255, 0, 127], [255, 0, 127]],
                        [[255, 127, 0], [255, 127, 0], [255, 127, 0]]])
    assert np.prod(S3.invert_colors_manual(img_in) == np.array(img_out))
def test_innv_gray_levels_working():
    img_in = np.array([[[0, 255, 0], [0, 255, 0], [0, 255, 0]],
                       [[0, 255, 128], [0, 255, 128], [0, 255, 128]],
                       [[0, 128, 255], [0, 128, 255], [0, 128, 255]]],
                      dtype=np.uint8)
    img_out = np.array([[[255, 0, 255], [255, 0, 255], [255, 0, 255]],
                        [[255, 0, 127], [255, 0, 127], [255, 0, 127]],
                        [[255, 127, 0], [255, 127, 0], [255, 127, 0]]],
                       dtype=np.uint8)
    assert np.prod(S3.innv_gray_levels(img_in) == np.array(img_out))
Exemple #4
0
def test_invert_colors_numpy_no_img_out():
    img_in = np.array([[[0, 255, 0], [0, 255, 0], [0, 255, 0]],
                       [[0, 255, 128], [0, 255, 128], [0, 255, 128]],
                       [[0, 128, 255], [0, 128, 255], [0, 128, 255]]],
                      dtype=np.uint8)
    img_out = np.array([[[255, 0, 255], [255, 0, 255], [255, 0, 255]],
                        [[255, 0, 127], [255, 0, 127], [255, 0, 127]],
                        [[255, 127, 0], [255, 127, 0], [255, 127, 0]]],
                       dtype=np.uint8)
    with pytest.raises(TypeError):
        np.prod(S3.invert_colors_manual(img_in) == np.array())
def test_invert_colors_numpy_uint8():
    with pytest.raises(TypeError):
        algo.inv_gray_levels(null_matrix)
def test_invert_colors_numpy_Aray():
    with pytest.raises(TypeError):
        algo.inv_gray_levels(1)
Exemple #7
0
def test_invert_colors_manual_tuNone():
    with pytest.raises(AttributeError):
        S3.invert_colors_manual(None)
def test_invert_color_TuUint8():
    with pytest.raises(TypeError):
        imgroc.invert_colors_manual(np.zeros((2, 2), dtype=np.float32))
Exemple #9
0
def test_invert_colors_opencv_is_empty():
    with pytest.raises(TypeError):
        S3.invert_colors_opencv()
def test_innv_gray_levels_uint8():
    with pytest.raises(TypeError):
        S3.innv_gray_levels(np.zeros((2, 2), np.dtype(np.bool)))
def test_innv_gray_levels_None():
    with pytest.raises(AttributeError):
        S3.innv_gray_levels(None)
def test_invert_numpy_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_colors_numpy(1)
def test_invert_manua_img_bgr_result():
    assert algo.invert_color_manual(img_bgr).all() == img_bgr_invert.all()
def test_invert_manua_img_bgr_uint8():
    with pt.raises(TypeError):
        algo.invert_color_manual(np.zeros((2, 2), dtype=np.float32))
def test_invert_manua_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_color_manual(1)
def test_invert_manual_img_bgr_None():
    with pt.raises(AttributeError):
        algo.invert_color_manual(None)
def test_invert_colors_numpy_None():
    with pytest.raises(ValueError):
        algo.inv_gray_levels(None)
def test_invert_numpy_img_bgr_result():
    assert algo.invert_colors_numpy(img_bgr).all() == img_bgr_invert.all()
Exemple #19
0
def test_invert_colors_manual_tuuint8():
    with pytest.raises(TypeError):
        S3.invert_colors_manual(np.zeros(2, 2), dtype=np.float32)
def test_invert_colors_manual_numpy_isNone():
    with pytest.raises(AttributeError):
        sa.invert_colors_manual_numpy(None)
def test_innv_gray_levels_Array():
    with pytest.raises(AttributeError):
        S3.innv_gray_levels(1)
def test_invert_colors_manual_numpy_isntUint8():
    with pytest.raises(TypeError):
        sa.invert_colors_manual_numpy(np.zeros((2, 2), dtype=np.float32))
def test_invert_opencv_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_colors_opencv(1)
Exemple #24
0
def test_innv_color_manual_Array():
    with pytest.raises(AttributeError):
        S3.invert_colors_manual(1)
def test_invert_colors_manual_numpy_isntNDArray():
    with pytest.raises(AttributeError):
        sa.invert_colors_manual_numpy(1)
def test_invert_opencv_img_bgr_uint8():
    with pt.raises(TypeError):
        algo.invert_colors_opencv(np.zeros((2, 2), dtype=np.float32))
def test_invert_color_TuAray():
    with pytest.raises(AttributeError):
        imgroc.invert_colors_manual(1)
def test_invert_opencv_img_bgr_result():
    assert algo.invert_colors_opencv(img_bgr).all() == img_bgr_invert.all()
def test_invert_color_TuProcessOk():
    imgroc.invert_colors_manual(np.zeros((2, 2, 2), dtype=np.uint8))
def test_invert_colors_manual_working():
    img_bgr = cv2.imread("pika.png", 1)
    inverted = s3.invert_colors_manual(img_bgr)
    assert type(inverted) == np.ndarray