Esempio n. 1
0
def test_threshold_minimum():
    camera = util.img_as_ubyte(camerad)

    threshold = threshold_minimum(camera)
    assert_array_equal(threshold, 85)

    astronaut = util.img_as_ubyte(astronautd)
    threshold = threshold_minimum(astronaut)
    assert_array_equal(threshold, 114)
Esempio n. 2
0
def test_threshold_minimum_synthetic():
    img = cp.arange(25 * 25, dtype=cp.uint8).reshape((25, 25))
    img[0:9, :] = 50
    img[14:25, :] = 250

    threshold = threshold_minimum(img)
    assert_array_equal(threshold, 95)
Esempio n. 3
0
def test_threshold_minimum_failure():
    img = cp.zeros((16 * 16), dtype=cp.uint8)
    with testing.raises(RuntimeError):
        threshold_minimum(img)
Esempio n. 4
0
def test_threshold_minimum_counts():
    camera = util.img_as_ubyte(camerad)
    counts, bin_centers = histogram(camera.ravel(), 256, source_range='image')
    threshold = threshold_minimum(hist=counts)
    assert_array_equal(threshold, 85)
Esempio n. 5
0
def test_threshold_minimum_histogram():
    camera = util.img_as_ubyte(camerad)
    hist = histogram(camera.ravel(), 256, source_range='image')
    threshold = threshold_minimum(hist=hist)
    assert_array_equal(threshold, 85)
Esempio n. 6
0
 def test_minimum(self):
     with pytest.raises(RuntimeError):
         threshold_minimum(self.image)