コード例 #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
コード例 #2
0
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))
コード例 #3
0
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))
コード例 #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)
コード例 #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))
コード例 #9
0
def test_invert_colors_opencv_is_empty():
    with pytest.raises(TypeError):
        S3.invert_colors_opencv()
コード例 #10
0
def test_innv_gray_levels_uint8():
    with pytest.raises(TypeError):
        S3.innv_gray_levels(np.zeros((2, 2), np.dtype(np.bool)))
コード例 #11
0
def test_innv_gray_levels_None():
    with pytest.raises(AttributeError):
        S3.innv_gray_levels(None)
コード例 #12
0
def test_invert_numpy_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_colors_numpy(1)
コード例 #13
0
def test_invert_manua_img_bgr_result():
    assert algo.invert_color_manual(img_bgr).all() == img_bgr_invert.all()
コード例 #14
0
def test_invert_manua_img_bgr_uint8():
    with pt.raises(TypeError):
        algo.invert_color_manual(np.zeros((2, 2), dtype=np.float32))
コード例 #15
0
def test_invert_manua_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_color_manual(1)
コード例 #16
0
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)
コード例 #18
0
def test_invert_numpy_img_bgr_result():
    assert algo.invert_colors_numpy(img_bgr).all() == img_bgr_invert.all()
コード例 #19
0
def test_invert_colors_manual_tuuint8():
    with pytest.raises(TypeError):
        S3.invert_colors_manual(np.zeros(2, 2), dtype=np.float32)
コード例 #20
0
def test_invert_colors_manual_numpy_isNone():
    with pytest.raises(AttributeError):
        sa.invert_colors_manual_numpy(None)
コード例 #21
0
def test_innv_gray_levels_Array():
    with pytest.raises(AttributeError):
        S3.innv_gray_levels(1)
コード例 #22
0
def test_invert_colors_manual_numpy_isntUint8():
    with pytest.raises(TypeError):
        sa.invert_colors_manual_numpy(np.zeros((2, 2), dtype=np.float32))
コード例 #23
0
def test_invert_opencv_img_bgr_type():
    with pt.raises(AttributeError):
        algo.invert_colors_opencv(1)
コード例 #24
0
def test_innv_color_manual_Array():
    with pytest.raises(AttributeError):
        S3.invert_colors_manual(1)
コード例 #25
0
def test_invert_colors_manual_numpy_isntNDArray():
    with pytest.raises(AttributeError):
        sa.invert_colors_manual_numpy(1)
コード例 #26
0
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)
コード例 #28
0
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))
コード例 #30
0
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