当前位置: 首页>>代码示例>>Python>>正文


Python augmenters.Sharpen方法代码示例

本文整理汇总了Python中imgaug.augmenters.Sharpen方法的典型用法代码示例。如果您正苦于以下问题:Python augmenters.Sharpen方法的具体用法?Python augmenters.Sharpen怎么用?Python augmenters.Sharpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在imgaug.augmenters的用法示例。


在下文中一共展示了augmenters.Sharpen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: chapter_augmenters_sometimes

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def chapter_augmenters_sometimes():
    aug = iaa.Sometimes(0.5, iaa.GaussianBlur(sigma=2.0))
    run_and_save_augseq(
        "sometimes.jpg", aug,
        [ia.quokka(size=(64, 64)) for _ in range(16)], cols=8, rows=2,
        seed=2
    )

    aug = iaa.Sometimes(
        0.5,
        iaa.GaussianBlur(sigma=2.0),
        iaa.Sequential([iaa.Affine(rotate=45), iaa.Sharpen(alpha=1.0)])
    )
    run_and_save_augseq(
        "sometimes_if_else.jpg", aug,
        [ia.quokka(size=(64, 64)) for _ in range(16)], cols=8, rows=2
    ) 
开发者ID:JoshuaPiinRueyPan,项目名称:ViolenceDetection,代码行数:19,代码来源:generate_documentation_images.py

示例2: chapter_augmenters_sharpen

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def chapter_augmenters_sharpen():
    aug = iaa.Sharpen(alpha=(0.0, 1.0), lightness=(0.75, 2.0))
    run_and_save_augseq(
        "sharpen.jpg", aug,
        [ia.quokka(size=(64, 64)) for _ in range(16)], cols=8, rows=2
    )

    #alphas = [1/8*i for i in range(8)]
    alphas = np.linspace(0, 1.0, num=8)
    run_and_save_augseq(
        "sharpen_vary_alpha.jpg",
        [iaa.Sharpen(alpha=alpha, lightness=1.0) for alpha in alphas],
        [ia.quokka(size=(64, 64)) for _ in range(8)], cols=8, rows=1,
        quality=90
    )

    #lightnesses = [1/8*i for i in range(8)]
    lightnesses = np.linspace(0.75, 1.5, num=8)
    run_and_save_augseq(
        "sharpen_vary_lightness.jpg",
        [iaa.Sharpen(alpha=1.0, lightness=lightness) for lightness in lightnesses],
        [ia.quokka(size=(64, 64)) for _ in range(8)], cols=8, rows=1,
        quality=90
    ) 
开发者ID:JoshuaPiinRueyPan,项目名称:ViolenceDetection,代码行数:26,代码来源:generate_documentation_images.py

示例3: test_alpha_zero

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_zero(self):
        aug = iaa.Sharpen(alpha=0, lightness=1)
        observed = aug.augment_image(self.base_img)
        expected = self.base_img
        assert np.allclose(observed, expected) 
开发者ID:aleju,项目名称:imgaug,代码行数:7,代码来源:test_convolutional.py

示例4: test_alpha_one

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_one(self):
        aug = iaa.Sharpen(alpha=1.0, lightness=1)
        observed = aug.augment_image(self.base_img)
        expected = self.base_img_sharpened
        assert np.allclose(observed, expected) 
开发者ID:aleju,项目名称:imgaug,代码行数:7,代码来源:test_convolutional.py

示例5: test_alpha_050

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_050(self):
        aug = iaa.Sharpen(alpha=0.5, lightness=1)
        observed = aug.augment_image(self.base_img)
        expected = self._compute_sharpened_base_img(
            0.5*1, 0.5 * self.m_noop + 0.5 * self.m)
        assert np.allclose(observed, expected.astype(np.uint8)) 
开发者ID:aleju,项目名称:imgaug,代码行数:8,代码来源:test_convolutional.py

示例6: test_alpha_075

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_075(self):
        aug = iaa.Sharpen(alpha=0.75, lightness=1)
        observed = aug.augment_image(self.base_img)
        expected = self._compute_sharpened_base_img(
            0.75*1, 0.25 * self.m_noop + 0.75 * self.m)
        assert np.allclose(observed, expected) 
开发者ID:aleju,项目名称:imgaug,代码行数:8,代码来源:test_convolutional.py

示例7: test_alpha_is_stochastic_parameter

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_is_stochastic_parameter(self):
        aug = iaa.Sharpen(alpha=iap.Choice([0.5, 1.0]), lightness=1)
        observed = aug.augment_image(self.base_img)
        expected1 = self._compute_sharpened_base_img(
            0.5*1, 0.5 * self.m_noop + 0.5 * self.m)
        expected2 = self._compute_sharpened_base_img(
            1.0*1, 0.0 * self.m_noop + 1.0 * self.m)
        assert (
            np.allclose(observed, expected1)
            or np.allclose(observed, expected2)
        ) 
开发者ID:aleju,项目名称:imgaug,代码行数:13,代码来源:test_convolutional.py

示例8: test_alpha_1_lightness_2

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_1_lightness_2(self):
        aug = iaa.Sharpen(alpha=1.0, lightness=2)
        observed = aug.augment_image(self.base_img)
        expected = self._compute_sharpened_base_img(1.0*2, self.m)
        assert np.allclose(observed, expected) 
开发者ID:aleju,项目名称:imgaug,代码行数:7,代码来源:test_convolutional.py

示例9: test_alpha_1_lightness_3

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_1_lightness_3(self):
        aug = iaa.Sharpen(alpha=1.0, lightness=3)
        observed = aug.augment_image(self.base_img)
        expected = self._compute_sharpened_base_img(1.0*3, self.m)
        assert np.allclose(observed, expected) 
开发者ID:aleju,项目名称:imgaug,代码行数:7,代码来源:test_convolutional.py

示例10: test_alpha_1_lightness_is_stochastic_parameter

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_alpha_1_lightness_is_stochastic_parameter(self):
        aug = iaa.Sharpen(alpha=1.0, lightness=iap.Choice([1.0, 1.5]))
        observed = aug.augment_image(self.base_img)
        expected1 = self._compute_sharpened_base_img(1.0*1.0, self.m)
        expected2 = self._compute_sharpened_base_img(1.0*1.5, self.m)
        assert (
            np.allclose(observed, expected1)
            or np.allclose(observed, expected2)
        ) 
开发者ID:aleju,项目名称:imgaug,代码行数:11,代码来源:test_convolutional.py

示例11: test_failure_if_lightness_has_bad_datatype

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_failure_if_lightness_has_bad_datatype(self):
        # don't use assertRaisesRegex, because it doesnt exist in 2.7
        got_exception = False
        try:
            _ = iaa.Sharpen(alpha=1.0, lightness="test")
        except Exception as exc:
            assert "Expected " in str(exc)
            got_exception = True
        assert got_exception

    # this part doesnt really work so far due to nonlinearities resulting
    # from clipping to uint8 
开发者ID:aleju,项目名称:imgaug,代码行数:14,代码来源:test_convolutional.py

示例12: test_pickleable

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def test_pickleable(self):
        aug = iaa.Sharpen(alpha=(0.0, 1.0), lightness=(1, 3), seed=1)
        runtest_pickleable_uint8_img(aug, iterations=20) 
开发者ID:aleju,项目名称:imgaug,代码行数:5,代码来源:test_convolutional.py

示例13: __init__

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def __init__(self, alpha=(0.2, 0.5), lightness=(0.5, 1.), prob=0.5):
        super().__init__(prob)
        self.processor = iaa.Sharpen(alpha, lightness) 
开发者ID:selimsef,项目名称:dsb2018_topcoders,代码行数:5,代码来源:transforms.py

示例14: chapter_augmenters_someof

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def chapter_augmenters_someof():
    aug = iaa.SomeOf(2, [
        iaa.Affine(rotate=45),
        iaa.AdditiveGaussianNoise(scale=0.2*255),
        iaa.Add(50, per_channel=True),
        iaa.Sharpen(alpha=0.5)
    ])
    run_and_save_augseq(
        "someof.jpg", aug,
        [ia.quokka(size=(128, 128)) for _ in range(8)], cols=4, rows=2
    )

    aug = iaa.SomeOf((0, None), [
        iaa.Affine(rotate=45),
        iaa.AdditiveGaussianNoise(scale=0.2*255),
        iaa.Add(50, per_channel=True),
        iaa.Sharpen(alpha=0.5)
    ])
    run_and_save_augseq(
        "someof_0_to_none.jpg", aug,
        [ia.quokka(size=(128, 128)) for _ in range(8)], cols=4, rows=2
    )

    aug = iaa.SomeOf(2, [
        iaa.Affine(rotate=45),
        iaa.AdditiveGaussianNoise(scale=0.2*255),
        iaa.Add(50, per_channel=True),
        iaa.Sharpen(alpha=0.5)
    ], random_order=True)
    run_and_save_augseq(
        "someof_random_order.jpg", aug,
        [ia.quokka(size=(128, 128)) for _ in range(8)], cols=4, rows=2
    ) 
开发者ID:JoshuaPiinRueyPan,项目名称:ViolenceDetection,代码行数:35,代码来源:generate_documentation_images.py

示例15: chapter_augmenters_oneof

# 需要导入模块: from imgaug import augmenters [as 别名]
# 或者: from imgaug.augmenters import Sharpen [as 别名]
def chapter_augmenters_oneof():
    aug = iaa.OneOf([
        iaa.Affine(rotate=45),
        iaa.AdditiveGaussianNoise(scale=0.2*255),
        iaa.Add(50, per_channel=True),
        iaa.Sharpen(alpha=0.5)
    ])
    run_and_save_augseq(
        "oneof.jpg", aug,
        [ia.quokka(size=(128, 128)) for _ in range(8)], cols=4, rows=2
    ) 
开发者ID:JoshuaPiinRueyPan,项目名称:ViolenceDetection,代码行数:13,代码来源:generate_documentation_images.py


注:本文中的imgaug.augmenters.Sharpen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。