Exemplo n.º 1
0
 def test_yen_binary(self):
     image = cp.zeros([2, 256], dtype=cp.uint8)
     image[0] = 255
     assert threshold_yen(image) < 1
Exemplo n.º 2
0
 def test_yen_float_image(self):
     image = self.image.astype(cp.float64)
     assert 2 <= threshold_yen(image) < 3
Exemplo n.º 3
0
 def test_yen_arange(self):
     image = cp.arange(256)
     assert threshold_yen(image) == 127
Exemplo n.º 4
0
 def test_yen(self):
     assert threshold_yen(self.image) == 2
Exemplo n.º 5
0
 def test_yen_negative_int(self):
     image = self.image - 2
     assert threshold_yen(image) == 0
Exemplo n.º 6
0
def test_yen_coins_image():
    coins = util.img_as_ubyte(coinsd)
    assert 109 < threshold_yen(coins) < 111
Exemplo n.º 7
0
def test_yen_coins_image_as_float():
    coins = util.img_as_float(coinsd)
    assert 0.43 < threshold_yen(coins) < 0.44
Exemplo n.º 8
0
def test_yen_camera_image_counts():
    camera = util.img_as_ubyte(camerad)
    counts, bin_centers = histogram(camera.ravel(), 256, source_range='image')
    assert 145 < threshold_yen(hist=counts) < 147
Exemplo n.º 9
0
def test_yen_camera_image_histogram():
    camera = util.img_as_ubyte(camerad)
    hist = histogram(camera.ravel(), 256, source_range="image")
    assert 145 < threshold_yen(hist=hist) < 147
Exemplo n.º 10
0
def test_yen_camera_image():
    camera = util.img_as_ubyte(camerad)
    assert 145 < threshold_yen(camera) < 147
Exemplo n.º 11
0
 def test_yen_blank_max(self):
     image = cp.empty((5, 5), dtype=cp.uint8)
     image.fill(255)
     assert threshold_yen(image) == 255
Exemplo n.º 12
0
 def test_yen_blank_zero(self):
     image = cp.zeros((5, 5), dtype=cp.uint8)
     assert threshold_yen(image) == 0