mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 01:55:39 +08:00
Merge branch 'master' of git://github.com/scikit-image/scikit-image
This commit is contained in:
+5
-2
@@ -64,9 +64,9 @@ Library:
|
||||
Extension: skimage.filter._ctmf
|
||||
Sources:
|
||||
skimage/filter/_ctmf.pyx
|
||||
Extension: skimage.filter._denoise
|
||||
Extension: skimage.filter._denoise_cy
|
||||
Sources:
|
||||
skimage/filter/_denoise.pyx
|
||||
skimage/filter/_denoise_cy.pyx
|
||||
Extension: skimage.morphology.ccomp
|
||||
Sources:
|
||||
skimage/morphology/ccomp.pyx
|
||||
@@ -91,6 +91,9 @@ Library:
|
||||
Extension: skimage.morphology._greyreconstruct
|
||||
Sources:
|
||||
skimage/morphology/_greyreconstruct.pyx
|
||||
Extension: skimage.feature.corner_cy
|
||||
Sources:
|
||||
skimage/feature/corner_cy.pyx
|
||||
Extension: skimage.feature._texture
|
||||
Sources:
|
||||
skimage/feature/_texture.pyx
|
||||
|
||||
@@ -138,7 +138,7 @@ if __name__ == "__main__":
|
||||
|
||||
configuration=configuration,
|
||||
|
||||
packages=setuptools.find_packages(),
|
||||
packages=setuptools.find_packages(exclude=['doc']),
|
||||
include_package_data=True,
|
||||
zip_safe=False, # the package can run out of an .egg file
|
||||
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
from ._draw import line, polygon, ellipse, circle, circle_perimeter, ellipse_perimeter, set_color
|
||||
from ._draw import line, polygon, ellipse, ellipse_perimeter, \
|
||||
circle, circle_perimeter, set_color
|
||||
|
||||
|
||||
bresenham = line
|
||||
|
||||
+18
-8
@@ -28,6 +28,7 @@ def line(int y, int x, int y2, int x2):
|
||||
``img[rr, cc] = 1``.
|
||||
|
||||
"""
|
||||
|
||||
cdef np.ndarray[np.int32_t, ndim=1, mode="c"] rr, cc
|
||||
|
||||
cdef int steep = 0
|
||||
@@ -92,7 +93,9 @@ def polygon(y, x, shape=None):
|
||||
Pixel coordinates of polygon.
|
||||
May be used to directly index into an array, e.g.
|
||||
``img[rr, cc] = 1``.
|
||||
|
||||
"""
|
||||
|
||||
cdef int nr_verts = x.shape[0]
|
||||
cdef int minr = <int>max(0, y.min())
|
||||
cdef int maxr = <int>math.ceil(y.max())
|
||||
@@ -142,7 +145,9 @@ def ellipse(double cy, double cx, double yradius, double xradius, shape=None):
|
||||
Pixel coordinates of ellipse.
|
||||
May be used to directly index into an array, e.g.
|
||||
``img[rr, cc] = 1``.
|
||||
|
||||
"""
|
||||
|
||||
cdef int minr = <int>max(0, cy - yradius)
|
||||
cdef int maxr = <int>math.ceil(cy + yradius)
|
||||
cdef int minc = <int>max(0, cx - xradius)
|
||||
@@ -184,7 +189,9 @@ def circle(double cy, double cx, double radius, shape=None):
|
||||
Pixel coordinates of circle.
|
||||
May be used to directly index into an array, e.g.
|
||||
``img[rr, cc] = 1``.
|
||||
|
||||
"""
|
||||
|
||||
return ellipse(cy, cx, radius, radius, shape)
|
||||
|
||||
|
||||
@@ -287,16 +294,16 @@ def ellipse_perimeter(int cy, int cx, int yradius, int xradius):
|
||||
----------
|
||||
.. [1] J. Kennedy "A fast Bresenham type algorithm for
|
||||
drawing ellipses".
|
||||
|
||||
"""
|
||||
# If both radii == 0, return the center
|
||||
# to avoid infinite loop in 2nd set
|
||||
|
||||
# If both radii == 0, return the center to avoid infinite loop in 2nd set
|
||||
if xradius == 0 and yradius == 0:
|
||||
return np.array(cy), np.array(cx)
|
||||
|
||||
# a and b are xradius an yradius
|
||||
# compute 2a^2 and 2b^2
|
||||
cdef int twoasquared = 2 * xradius * xradius
|
||||
cdef int twobsquared = 2 * yradius * yradius
|
||||
# a and b are xradius an yradius compute 2a^2 and 2b^2
|
||||
cdef int twoasquared = 2 * xradius**2
|
||||
cdef int twobsquared = 2 * yradius**2
|
||||
|
||||
# Pixels
|
||||
cdef list px = list()
|
||||
@@ -353,8 +360,9 @@ def ellipse_perimeter(int cy, int cx, int yradius, int xradius):
|
||||
|
||||
|
||||
def set_color(img, coords, color):
|
||||
"""Set pixel color in the image at the given coordinates. Coordinates that
|
||||
exceed the shape of the image will be ignored.
|
||||
"""Set pixel color in the image at the given coordinates.
|
||||
|
||||
Coordinates that exceed the shape of the image will be ignored.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -369,7 +377,9 @@ def set_color(img, coords, color):
|
||||
-------
|
||||
img : (M, N, D) ndarray
|
||||
The updated image.
|
||||
|
||||
"""
|
||||
|
||||
rr, cc = coords
|
||||
rr_inside = np.logical_and(rr >= 0, rr < img.shape[0])
|
||||
cc_inside = np.logical_and(cc >= 0, cc < img.shape[1])
|
||||
|
||||
@@ -15,7 +15,7 @@ def configuration(parent_package='', top_path=None):
|
||||
cython(['_draw.pyx'], working_path=base_path)
|
||||
|
||||
config.add_extension('_draw', sources=['_draw.c'],
|
||||
include_dirs=[get_numpy_include_dirs(), '../shared'])
|
||||
include_dirs=[get_numpy_include_dirs(), '../_shared'])
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@@ -142,8 +142,8 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
|
||||
centre = tuple([y * cy + cy // 2, x * cx + cx // 2])
|
||||
dx = radius * cos(float(o) / orientations * np.pi)
|
||||
dy = radius * sin(float(o) / orientations * np.pi)
|
||||
rr, cc = draw.bresenham(centre[0] - dy, centre[1] - dx,
|
||||
centre[0] + dy, centre[1] + dx)
|
||||
rr, cc = draw.bresenham(centre[0] - dx, centre[1] - dy,
|
||||
centre[0] + dx, centre[1] + dy)
|
||||
hog_image[rr, cc] += orientation_histogram[y, x, o]
|
||||
|
||||
"""
|
||||
|
||||
@@ -31,6 +31,7 @@ def test_square_image():
|
||||
def test_noisy_square_image():
|
||||
im = np.zeros((50, 50)).astype(float)
|
||||
im[:25, :25] = 1.
|
||||
np.random.seed(seed=1234)
|
||||
im = im + np.random.uniform(size=im.shape) * .2
|
||||
|
||||
# Moravec
|
||||
|
||||
@@ -4,6 +4,9 @@ from numpy.testing import run_module_suite, assert_raises, assert_equal
|
||||
from skimage import filter, data, color, img_as_float
|
||||
|
||||
|
||||
np.random.seed(1234)
|
||||
|
||||
|
||||
lena = img_as_float(data.lena()[:256, :256])
|
||||
lena_gray = color.rgb2gray(lena)
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ from numpy.testing import assert_equal, assert_raises
|
||||
from skimage.measure import structural_similarity as ssim
|
||||
|
||||
|
||||
np.random.seed(1234)
|
||||
|
||||
|
||||
def test_ssim_patch_range():
|
||||
N = 51
|
||||
X = (np.random.random((N, N)) * 255).astype(np.uint8)
|
||||
|
||||
@@ -29,7 +29,7 @@ def configuration(parent_package='', top_path=None):
|
||||
config.add_extension('_skeletonize_cy', sources=['_skeletonize_cy.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
config.add_extension('_pnpoly', sources=['_pnpoly.c'],
|
||||
include_dirs=[get_numpy_include_dirs(), '../shared'])
|
||||
include_dirs=[get_numpy_include_dirs(), '../_shared'])
|
||||
config.add_extension('_convex_hull', sources=['_convex_hull.c'],
|
||||
include_dirs=[get_numpy_include_dirs()])
|
||||
config.add_extension('_greyreconstruct', sources=['_greyreconstruct.c'],
|
||||
|
||||
Reference in New Issue
Block a user