mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 17:45:20 +08:00
Convenience functions to load example images.
This commit is contained in:
committed by
Stefan van der Walt
parent
f3b8aec67f
commit
41ed86d49b
@@ -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)
|
||||
|
||||
@@ -1,4 +1,24 @@
|
||||
import scipy.misc as _m
|
||||
"""Convinience functions to get sample data"""
|
||||
|
||||
lena = _m.lena
|
||||
import os
|
||||
|
||||
from ..io import imread
|
||||
from ...image import data_dir
|
||||
|
||||
def camera():
|
||||
"""Example gray "camera" image, often used for segmentation
|
||||
and denoising examples."""
|
||||
|
||||
return imread(os.path.join(data_dir, "camera.png"))
|
||||
|
||||
def lena():
|
||||
"""Example "Lena" image. """
|
||||
return imread(os.path.join(data_dir, "lena.png"))
|
||||
|
||||
def checkerboard():
|
||||
"""Checkerboard image"""
|
||||
return imread(os.path.join(data_dir, "chessboard_RGB.png"))
|
||||
|
||||
def checkerboard_gray():
|
||||
"""Checkerboard image, only gray channel"""
|
||||
return imread(os.path.join(data_dir, "chessboard_GRAY.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,22 @@
|
||||
import unittest
|
||||
|
||||
import scikits.image.data as data
|
||||
|
||||
class TestData(unittest.TestCase):
|
||||
def test_lena(self):
|
||||
""" Test that "Lena" image can be loaded. """
|
||||
data.lena()
|
||||
|
||||
def test_camera(self):
|
||||
""" Test that "camera" image can be loaded. """
|
||||
data.camera()
|
||||
|
||||
def test_checkerboard(self):
|
||||
""" Test that checkerboard image can be loaded. """
|
||||
data.checkerboard()
|
||||
|
||||
def test_checkerboard_gray(self):
|
||||
""" Test that checkerboard grayscale image can be loaded. """
|
||||
data.checkerboard_gray()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user