mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 16:24:33 +08:00
Merge branch 'data_loader'
This commit is contained in:
@@ -64,3 +64,7 @@
|
||||
|
||||
- The Scikit Learn team
|
||||
From whom we borrowed the example generation tools.
|
||||
|
||||
- Andreas Mueller
|
||||
Example data set loader.
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ coveragetable:
|
||||
|
||||
html: api coveragetable
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(DEST)/html
|
||||
cp source/plots $(DEST)/html -r
|
||||
cp -r source/plots $(DEST)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in build/html."
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from scikits.image import data
|
||||
from scikits.image import color
|
||||
from scikits.image.filter import tv_denoise
|
||||
|
||||
l = data.lena()
|
||||
l = color.rgb2gray(data.lena())
|
||||
l = l[230:290, 220:320]
|
||||
|
||||
noisy = l + 0.4*l.std()*np.random.random(l.shape)
|
||||
|
||||
+2
-2
@@ -45,11 +45,11 @@ source_suffix = '.txt'
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'contents'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'scikits.image'
|
||||
copyright = u'2009, SciPy Developers'
|
||||
copyright = u'2011, scikits-image team'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
|
||||
@@ -595,8 +595,23 @@ tt {
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #ede;
|
||||
color: #333;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#api-reference ul:first-child {
|
||||
|
||||
@@ -1,4 +1,42 @@
|
||||
import scipy.misc as _m
|
||||
"""Convenience functions to load sample data.
|
||||
|
||||
lena = _m.lena
|
||||
"""
|
||||
|
||||
import os as _os
|
||||
|
||||
from ..io import imread
|
||||
from ...image import data_dir
|
||||
|
||||
def load(f):
|
||||
"""Load an image file located in the data directory.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
f : string
|
||||
File name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
img : ndarray
|
||||
Image loaded from scikits.image.data_dir.
|
||||
"""
|
||||
return imread(_os.path.join(data_dir, f))
|
||||
|
||||
def camera():
|
||||
"""Gray "camera" image, often used for segmentation
|
||||
and denoising examples.
|
||||
|
||||
"""
|
||||
return load("camera.png")
|
||||
|
||||
def lena():
|
||||
"""Colour "Lena" image.
|
||||
|
||||
"""
|
||||
return load("lena.png")
|
||||
|
||||
def checkerboard():
|
||||
"""Checkerboard image.
|
||||
|
||||
"""
|
||||
return load("chessboard_RGB.png")
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 112 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 464 KiB |
@@ -0,0 +1,23 @@
|
||||
import scikits.image.data as data
|
||||
from numpy.testing import assert_equal, assert_array_equal
|
||||
import numpy as np
|
||||
|
||||
def test_lena():
|
||||
""" Test that "Lena" image can be loaded. """
|
||||
lena = data.lena()
|
||||
assert_equal(lena.shape, (512, 512, 3))
|
||||
|
||||
def test_camera():
|
||||
""" Test that "camera" image can be loaded. """
|
||||
cameraman = data.camera()
|
||||
assert_equal(cameraman.ndim, 2)
|
||||
|
||||
def test_checkerboard():
|
||||
""" Test that checkerboard image can be loaded. """
|
||||
checkerboard = data.checkerboard()
|
||||
assert_equal(checkerboard.dtype, np.uint8)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from numpy.testing import run_module_suite
|
||||
run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user