示例#1
0
def test_bimodal_multiotsu_hist():
    for name in ['camera', 'moon', 'coins', 'text', 'clock', 'page']:
        img = cp.array(getattr(data, name)())
        assert threshold_otsu(img) == threshold_multiotsu(img, 2)

    for name in ['chelsea', 'coffee', 'astronaut', 'rocket']:
        img = rgb2gray(cp.array(getattr(data, name)()))
        assert threshold_otsu(img) == threshold_multiotsu(img, 2)
示例#2
0
 def test_otsu_float_image(self):
     image = self.image.astype(cp.float64)
     assert 2 <= threshold_otsu(image) < 3
示例#3
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
示例#4
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
示例#5
0
def test_otsu_astro_image():
    img = util.img_as_ubyte(astronautd)
    with expected_warnings(['grayscale']):
        assert 109 < threshold_otsu(img) < 111
示例#6
0
def test_otsu_one_color_image_3d():
    img = cp.ones((10, 10, 10), dtype=np.uint8)
    assert threshold_otsu(img) == 1
示例#7
0
def test_otsu_coins_image_as_float():
    coins = util.img_as_float(coinsd)
    assert 0.41 < threshold_otsu(coins) < 0.42
示例#8
0
def test_otsu_coins_image():
    coins = util.img_as_ubyte(coinsd)
    assert 106 < threshold_otsu(coins) < 108
示例#9
0
def test_otsu_camera_image_counts():
    camera = util.img_as_ubyte(camerad)
    counts, bin_centers = histogram(camera.ravel(), 256, source_range="image")
    assert 101 < threshold_otsu(hist=counts) < 103
示例#10
0
def test_otsu_camera_image_histogram():
    camera = util.img_as_ubyte(camerad)
    hist = histogram(camera.ravel(), 256, source_range="image")
    assert 101 < threshold_otsu(hist=hist) < 103
示例#11
0
def test_otsu_camera_image():
    camera = util.img_as_ubyte(camerad)
    assert 101 < threshold_otsu(camera) < 103