Ejemplo n.º 1
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
Ejemplo n.º 2
0
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
Ejemplo n.º 3
0
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
Ejemplo n.º 4
0
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
Ejemplo n.º 5
0
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
Ejemplo n.º 6
0
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
Ejemplo n.º 7
0
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
Ejemplo n.º 8
0
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
Ejemplo n.º 9
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
Ejemplo n.º 10
0
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
Ejemplo n.º 11
0
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
Ejemplo n.º 12
0
def test_otsu_astro_image():
    img = skimage.img_as_ubyte(data.astronaut())
    assert 109 < threshold_otsu(img) < 111
Ejemplo n.º 13
0
from skimage.filter.thresholding import threshold_otsu
import scipy.misc
import Image

# opening the image and converting it to grayscale
a = Image.open('../Figures/sem3.png').convert('L')
# a is converted to an ndarray
a = scipy.misc.fromimage(a)
# performing Otsu's thresholding
thresh = threshold_otsu(a)
# pixels with intensity greater than
# theshold are kept
b = a > thresh
# b is converted from ndimage to
b = scipy.misc.toimage(b)
# saving the image as sk_otsu.png
b.save('../Figures/otsu_semoutput.png')
Ejemplo n.º 14
0
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
Ejemplo n.º 15
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
Ejemplo n.º 16
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
Ejemplo n.º 17
0
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
Ejemplo n.º 18
0
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
Ejemplo n.º 19
0
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
Ejemplo n.º 20
0
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87
Ejemplo n.º 21
0
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
Ejemplo n.º 22
0
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87