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


Python thresholding.threshold_li函数代码示例

本文整理汇总了Python中skimage.filters.thresholding.threshold_li函数的典型用法代码示例。如果您正苦于以下问题:Python threshold_li函数的具体用法?Python threshold_li怎么用?Python threshold_li使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_li_camera_image

def test_li_camera_image():
    image = skimage.img_as_ubyte(data.camera())
    threshold = threshold_li(image)
    ce_actual = _cross_entropy(image, threshold)
    assert 62 < threshold_li(image) < 63
    assert ce_actual < _cross_entropy(image, threshold + 1)
    assert ce_actual < _cross_entropy(image, threshold - 1)
开发者ID:jmetz,项目名称:scikit-image,代码行数:7,代码来源:test_thresholding.py

示例2: test_li_coins_image

def test_li_coins_image():
    image = skimage.img_as_ubyte(data.coins())
    threshold = threshold_li(image)
    ce_actual = _cross_entropy(image, threshold)
    assert 94 < threshold_li(image) < 95
    assert ce_actual < _cross_entropy(image, threshold + 1)
    # in the case of the coins image, the minimum cross-entropy is achieved one
    # threshold below that found by the iterative method. Not sure why that is
    # but `threshold_li` does find the stationary point of the function (ie the
    # tolerance can be reduced arbitrarily but the exact same threshold is
    # found), so my guess some kind of histogram binning effect.
    assert ce_actual < _cross_entropy(image, threshold - 2)
开发者ID:jmetz,项目名称:scikit-image,代码行数:12,代码来源:test_thresholding.py

示例3: test_li_astro_image

def test_li_astro_image():
    image = skimage.img_as_ubyte(data.astronaut())
    threshold = threshold_li(image)
    ce_actual = _cross_entropy(image, threshold)
    assert 64 < threshold < 65
    assert ce_actual < _cross_entropy(image, threshold + 1)
    assert ce_actual < _cross_entropy(image, threshold - 1)
开发者ID:jmetz,项目名称:scikit-image,代码行数:7,代码来源:test_thresholding.py

示例4: test_li_coins_image_as_float

def test_li_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.37 < threshold_li(coins) < 0.38
开发者ID:Gildus,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例5: test_li_coins_image

def test_li_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 95 < threshold_li(coins) < 97
开发者ID:Gildus,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例6: test_li_camera_image

def test_li_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 63 < threshold_li(camera) < 65
开发者ID:Gildus,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例7: test_li_constant_image

 def test_li_constant_image(self):
     with pytest.raises(ValueError):
         threshold_li(np.ones((10,10)))
开发者ID:andreydung,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例8: test_li_constant_image

 def test_li_constant_image(self):
     assert threshold_li(np.ones((10, 10))) == 1.
开发者ID:jmetz,项目名称:scikit-image,代码行数:2,代码来源:test_thresholding.py

示例9: test_li_negative_int

 def test_li_negative_int(self):
     image = self.image - 2
     assert int(threshold_li(image)) == 0
开发者ID:Gildus,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例10: test_li_constant_image_with_nan

def test_li_constant_image_with_nan():
    image = np.array([8, 8, 8, 8, np.nan])
    assert threshold_li(image) == 8
开发者ID:jmetz,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例11: test_li_inf_minus_inf

def test_li_inf_minus_inf():
    image = np.array([np.inf, -np.inf])
    assert threshold_li(image) == 0
开发者ID:jmetz,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例12: test_li_inf_image

def test_li_inf_image():
    image = np.array([np.inf, np.nan])
    assert threshold_li(image) == np.inf
开发者ID:jmetz,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例13: test_li_nan_image

def test_li_nan_image():
    image = np.full((5, 5), np.nan)
    assert np.isnan(threshold_li(image))
开发者ID:jmetz,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例14: test_li_coins_image_as_float

def test_li_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 94/255 < threshold_li(coins) < 95/255
开发者ID:jmetz,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py

示例15: test_li_astro_image

def test_li_astro_image():
    img = skimage.img_as_ubyte(data.astronaut())
    assert 66 < threshold_li(img) < 68
开发者ID:Gildus,项目名称:scikit-image,代码行数:3,代码来源:test_thresholding.py


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