Merge pull request #404 from keflavich/clearer_warp_example

Slight change to warp_coords docstring
This commit is contained in:
Johannes Schönberger
2012-12-26 00:22:10 -08:00
+7 -5
View File
@@ -849,6 +849,8 @@ def warp_coords(coord_map, shape, dtype=np.float64):
----------
coord_map : callable like GeometricTransform.inverse
Return input coordinates for given output coordinates.
Coordinates are in the shape (P,2), where P is the number
of coordinates and each element is an x,y pair
shape : tuple
Shape of output image ``(rows, cols[, bands])``.
dtype : np.dtype or string
@@ -875,18 +877,18 @@ def warp_coords(coord_map, shape, dtype=np.float64):
Examples
--------
Produce a coordinate map that Shifts an image to the right:
Produce a coordinate map that Shifts an image up and to the right:
>>> from skimage import data
>>> from scipy.ndimage import map_coordinates
>>>
>>> def shift_right(xy):
... xy[:, 0] -= 10
... return xy
>>> def shift_up10_left20(xy):
... return xy-np.array([-20,10])[None,:]
>>>
>>> image = data.lena().astype(np.float32)
>>> coords = warp_coords(shift_right, image.shape)
>>> coords = warp_coords(shift_up10_left20, image.shape)
>>> warped_image = map_coordinates(image, coords)
>>>
"""
rows, cols = shape[0], shape[1]