fix imports

This commit is contained in:
François Boulogne
2013-06-20 22:46:37 +02:00
parent 5ce5f283d0
commit 0a4fcdad0a
4 changed files with 33 additions and 18 deletions
+19 -14
View File
@@ -14,23 +14,27 @@ Authors
import os.path
import numpy as np
from numpy.testing import *
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_array_almost_equal,
assert_raises,
TestCase,
)
from skimage import img_as_float, img_as_ubyte
from skimage.io import imread
from skimage.color import (
rgb2hsv, hsv2rgb,
rgb2xyz, xyz2rgb,
rgb2hed, hed2rgb,
separate_stains,
combine_stains,
rgb2rgbcie, rgbcie2rgb,
convert_colorspace,
rgb2grey, gray2rgb,
xyz2lab, lab2xyz,
lab2rgb, rgb2lab,
is_rgb, is_gray
)
from skimage.color import (rgb2hsv, hsv2rgb,
rgb2xyz, xyz2rgb,
rgb2hed, hed2rgb,
separate_stains,
combine_stains,
rgb2rgbcie, rgbcie2rgb,
convert_colorspace,
rgb2grey, gray2rgb,
xyz2lab, lab2xyz,
lab2rgb, rgb2lab,
is_rgb, is_gray
)
from skimage import data_dir, data
@@ -267,4 +271,5 @@ def test_is_rgb():
if __name__ == "__main__":
from numpy.testing import run_module_suite
run_module_suite()
+9 -1
View File
@@ -4,7 +4,10 @@ from skimage import data
from skimage import feature
from skimage import img_as_float
from skimage import draw
from numpy.testing import *
from numpy.testing import (assert_raises,
assert_almost_equal,
)
def test_histogram_of_oriented_gradients():
img = img_as_float(data.lena()[:256, :].mean(axis=2))
@@ -14,16 +17,19 @@ def test_histogram_of_oriented_gradients():
assert len(fd) == 9 * (256 // 8) * (512 // 8)
def test_hog_image_size_cell_size_mismatch():
image = data.camera()[:150, :200]
fd = feature.hog(image, orientations=9, pixels_per_cell=(8, 8),
cells_per_block=(1, 1))
assert len(fd) == 9 * (150 // 8) * (200 // 8)
def test_hog_color_image_unsupported_error():
image = np.zeros((20, 20, 3))
assert_raises(ValueError, feature.hog, image)
def test_hog_basic_orientations_and_data_types():
# scenario:
# 1) create image (with float values) where upper half is filled by zeros, bottom half by 100
@@ -90,6 +96,7 @@ def test_hog_basic_orientations_and_data_types():
assert_almost_equal(actual, desired, decimal=2)
def test_hog_orientations_circle():
# scenario:
# 1) create image with blurred circle in the middle
@@ -129,6 +136,7 @@ def test_hog_orientations_circle():
desired = np.mean(hog_matrix)
assert_almost_equal(actual, desired, decimal=1)
if __name__ == '__main__':
from numpy.testing import run_module_suite
run_module_suite()
+1 -2
View File
@@ -1,5 +1,3 @@
from numpy.testing import *
import time
import random
import skimage.graph.heap as heap
@@ -49,4 +47,5 @@ def _test_heap(n, fast_update):
return t1 - t0
if __name__ == "__main__":
from numpy.testing import run_module_suite
run_module_suite()
+4 -1
View File
@@ -1,5 +1,8 @@
import numpy as np
from numpy.testing import *
from numpy.testing import (assert_array_equal,
assert_almost_equal,
)
import skimage.graph.mcp as mcp