Ejemplo n.º 1
0
def test_yen_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 197 < threshold_yen(camera) < 199
Ejemplo n.º 2
0
def test_yen_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 109 < threshold_yen(coins) < 111
Ejemplo n.º 3
0
def test_yen_camera_image_histogram():
    camera = util.img_as_ubyte(data.camera())
    hist = histogram(camera.ravel(), 256, source_range='image')
    assert 145 < threshold_yen(hist=hist) < 147
Ejemplo n.º 4
0
 def test_yen_blank_max(self):
     image = np.empty((5, 5), dtype=np.uint8)
     image.fill(255)
     assert threshold_yen(image) == 255
Ejemplo n.º 5
0
 def test_yen_arange(self):
     image = np.arange(256)
     assert threshold_yen(image) == 127
Ejemplo n.º 6
0
 def test_yen_blank_zero(self):
     image = np.zeros((5, 5), dtype=np.uint8)
     assert threshold_yen(image) == 0
Ejemplo n.º 7
0
 def test_yen_negative_int(self):
     image = self.image - 2
     assert threshold_yen(image) == 0
Ejemplo n.º 8
0
 def test_yen_negative_int(self):
     image = self.image - 2
     assert threshold_yen(image) == 0
Ejemplo n.º 9
0
def test_yen_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.43 < threshold_yen(coins) < 0.44
Ejemplo n.º 10
0
 def test_yen(self):
     assert threshold_yen(self.image) == 2
Ejemplo n.º 11
0
def test_yen_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 109 < threshold_yen(coins) < 111
Ejemplo n.º 12
0
def test_yen_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 197 < threshold_yen(camera) < 199
Ejemplo n.º 13
0
def test_yen_camera_image_counts():
    camera = util.img_as_ubyte(data.camera())
    counts, bin_centers = histogram(camera.ravel(), 256, source_range='image')
    assert 145 < threshold_yen(hist=counts) < 147
Ejemplo n.º 14
0
def test_yen_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.43 < threshold_yen(coins) < 0.44
Ejemplo n.º 15
0
 def test_yen_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_yen(image) < 3
Ejemplo n.º 16
0
 def test_yen(self):
     assert threshold_yen(self.image) == 2
Ejemplo n.º 17
0
 def test_yen_arange(self):
     image = np.arange(256)
     assert threshold_yen(image) == 127
Ejemplo n.º 18
0
 def test_yen_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_yen(image) < 3
Ejemplo n.º 19
0
 def test_yen_binary(self):
     image = np.zeros([2, 256], dtype=np.uint8)
     image[0] = 255
     assert threshold_yen(image) < 1
Ejemplo n.º 20
0
 def test_yen_binary(self):
     image = np.zeros([2, 256], dtype=np.uint8)
     image[0] = 255
     assert threshold_yen(image) < 1
Ejemplo n.º 21
0
 def test_yen_blank_zero(self):
     image = np.zeros((5, 5), dtype=np.uint8)
     assert threshold_yen(image) == 0
Ejemplo n.º 22
0
 def test_yen_blank_max(self):
     image = np.empty((5, 5), dtype=np.uint8)
     image.fill(255)
     assert threshold_yen(image) == 255
Ejemplo n.º 23
0
def test_yen_camera_image():
    camera = util.img_as_ubyte(data.camera())
    assert 145 < threshold_yen(camera) < 147