@@ -0,0 +1,978 @@
+%22%22%22%0A===============================%0APiecewise Affine Transformation%0A===============================%0A%0AThis example shows how to use the Piecewise Affine Transformation.%0A%22%22%22%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Afrom skimage.transform import PiecewiseAffineTransform, warp%0Afrom skimage import data%0A%0A%0Aimage = data.lena()%0Arows, cols = image.shape%5B0%5D, image.shape%5B1%5D%0A%0Asrc_cols = np.linspace(0, cols, 20)%0Asrc_rows = np.linspace(0, rows, 20)%0Asrc_rows, src_cols = np.meshgrid(src_rows, src_cols)%0Asrc = np.dstack(%5Bsrc_cols.flat, src_rows.flat%5D)%5B0%5D%0A%0A# add sinusoidal oscillation to row coordinates%0Adst_rows = src%5B:, 1%5D - np.sin(np.linspace(0, 3 * np.pi, src.shape%5B0%5D)) * 50%0Adst_cols = src%5B:, 0%5D%0Adst_rows *= 1.5%0Adst_rows -= 1.5 * 50%0Adst = np.vstack(%5Bdst_cols, dst_rows%5D).T%0A%0A%0Atform = PiecewiseAffineTransform()%0Atform.estimate(src, dst)%0A%0Aoutput_shape = (image.shape%5B0%5D - 1.5 * 50, image.shape%5B1%5D)%0Aout = warp(image, tform, output_shape=output_shape)%0A%0Aplt.imshow(out)%0Aplt.show()%0A

Add example script for piecewise affine transform