ENH: better docstring and test for warp_coords

This commit is contained in:
James Bergstra
2012-08-24 00:17:43 +02:00
committed by Johannes Schönberger
parent 5cce39a44a
commit c5dc55cd52
3 changed files with 37 additions and 12 deletions
+17 -1
View File
@@ -2,7 +2,7 @@ import sys
from numpy.testing import assert_array_almost_equal, run_module_suite
import numpy as np
from skimage.transform import (warp, fast_homography,
from skimage.transform import (warp, warp_coords, fast_homography,
AffineTransform,
ProjectiveTransform,
SimilarityTransform)
@@ -115,5 +115,21 @@ def test_warp_identity():
assert np.all(0 == warped_rgb_lena[:, :, 1])
def test_warp_coords_example():
from skimage import data
from scipy.ndimage import map_coordinates
def shift_right(xy):
print 'xyshape', xy.shape
xy[:, 0] -= 10
return xy
image = data.lena().astype(np.float32)
print 'testing'
print image.dtype, image.shape
coords = warp_coords(512, 512, 3, shift_right)
print 'warp_coords', coords.dtype, coords.shape
warped_image = map_coordinates(coords, image)
if __name__ == "__main__":
run_module_suite()