def __init__(self): self.augmentor_op = Operations.Greyscale(probability=1) self.imgaug_transform = iaa.Grayscale(alpha=1.0) self.solt_stream = slc.Stream([slt.CvtColor(mode="rgb2gs")])
def test_image_color_conversion_keepdim_type(keep_dim): with pytest.raises(TypeError): slt.CvtColor(keep_dim=keep_dim)
def test_cvtcolor_keeps_dimensions(img, expected): trf = slt.CvtColor(mode="rgb2gs") dc_res = trf({"image": img}) np.testing.assert_array_equal(expected, dc_res.data[0])
def test_image_color_conversion_raises_error(mode, mask_3x4): trf = slt.CvtColor(mode=mode) dc = slc.DataContainer(mask_3x4.squeeze(), "I") with pytest.raises(ValueError): trf(dc)
def test_hsv_returns_expected_results(mode, img, expected): trf = slt.CvtColor(mode=mode, keep_dim=False) dc = slc.DataContainer(img, "I") dc_res = trf(dc) np.testing.assert_array_equal(expected, dc_res.data[0])