Example #1
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
Example #6
0
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
Example #7
0
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
def test_otsu_astro_image():
    img = skimage.img_as_ubyte(data.astronaut())
    assert 109 < threshold_otsu(img) < 111
Example #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')
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
Example #15
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
Example #17
0
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
Example #19
0
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87
Example #21
0
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87