コード例 #1
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
コード例 #2
0
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
コード例 #3
0
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
コード例 #4
0
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
コード例 #5
0
def test_otsu_coins_image():
    assert threshold_otsu(data.coins()) == 107
コード例 #6
0
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
コード例 #7
0
def test_otsu_coins_image_as_float():
    coins = skimage.img_as_float(data.coins())
    assert 0.41 < threshold_otsu(coins) < 0.42
コード例 #8
0
def test_otsu_camera_image():
    camera = skimage.img_as_ubyte(data.camera())
    assert 86 < threshold_otsu(camera) < 88
コード例 #9
0
 def test_otsu(self):
     assert threshold_otsu(self.image) == 2
コード例 #10
0
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
コード例 #11
0
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
コード例 #12
0
def test_otsu_astro_image():
    img = skimage.img_as_ubyte(data.astronaut())
    assert 109 < threshold_otsu(img) < 111
コード例 #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')
コード例 #14
0
def test_otsu_lena_image():
    assert threshold_otsu(data.lena()) == 141
コード例 #15
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
コード例 #16
0
 def test_otsu_negative_int(self):
     image = self.image - 2
     assert threshold_otsu(image) == 0
コード例 #17
0
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
コード例 #18
0
 def test_otsu_float_image(self):
     image = np.float64(self.image)
     assert 2 <= threshold_otsu(image) < 3
コード例 #19
0
def test_otsu_coins_image():
    coins = skimage.img_as_ubyte(data.coins())
    assert 106 < threshold_otsu(coins) < 108
コード例 #20
0
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87
コード例 #21
0
def test_otsu_lena_image():
    lena = skimage.img_as_ubyte(data.lena())
    assert 140 < threshold_otsu(lena) < 142
コード例 #22
0
def test_otsu_camera_image():
    assert threshold_otsu(data.camera()) == 87