mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 23:11:31 +08:00
Added a new unit test
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
@@ -4,6 +4,9 @@ from scikits.image.morphology import skeletonize
|
||||
import numpy.testing
|
||||
from scikits.image.draw import draw
|
||||
from scipy.ndimage import correlate
|
||||
from scikits.image.io import imread
|
||||
from scikits.image import data_dir
|
||||
import os.path
|
||||
|
||||
class TestSkeletonize(unittest.TestCase):
|
||||
def test_skeletonize_no_foreground(self):
|
||||
@@ -48,6 +51,17 @@ class TestSkeletonize(unittest.TestCase):
|
||||
result = skeletonize.skeletonize(im)
|
||||
numpy.testing.assert_array_equal(result, im)
|
||||
|
||||
def test_skeletonize_output(self):
|
||||
im = imread(os.path.join(data_dir, "bw_text.png"), as_grey=True)
|
||||
|
||||
# make black the foreground
|
||||
im = (im==0)
|
||||
result = skeletonize.skeletonize(im)
|
||||
|
||||
expected = np.load(os.path.join(data_dir, "bw_text_skeleton.npy"))
|
||||
numpy.testing.assert_array_equal(result, expected)
|
||||
|
||||
|
||||
def test_skeletonize_num_neighbours(self):
|
||||
# an empty image
|
||||
image = np.zeros((300, 300))
|
||||
|
||||
Reference in New Issue
Block a user