You can do this by iterating over windows of your image with the following (pseudo-)code:
M = tf.estimate_transform('polynomial',pts2,pts1,order=3) for minr in range(0, image.shape[0], window_size): for minc in range(0, image.shape[1], window_size): coords = M(np.array(np.mgrid[minr:minr+window_size, minc:minc+window_size])) transformed_coords = M(coords) # TODO: reshape transformed_coords into the correct size, refer to tf.warp_coords for an example. total_output_image[window_bbox] = warp(image, transformed_coords, ...) I hope it is clear what I mean here? I don't have more time at the moment... On Fri, Oct 7, 2016, at 02:06 AM, Amaury Dehecq wrote: > Hello everyone, > > I'm using skimage to correct distortions on an image, using a polynomial > transformation. Basically, my commands can be summarized to: > > import skimage.transform as tf > > # estimate the transformation matrix from control points before > (pts2) and after (pts1) distortion > M=tf.estimate_transform('polynomial',pts2,pts1,order=3) > > # warp the initial image im > warped=tf.warp(im,M) > > This does exactly what I want, except that my image is very large (35000 > x 35000) and the script crashes if I try to run it for the whole image. > So I thought I could just cut my image into subimages and run warp for > each subimage. But as the matrix indexes are shifted (e.g always in the > interval [0-5000] instead of [0-350000]), I end up applying the same > correction to each subimage. > Is there a way to take into account the fact that my matrix is a subset, > for example by indicating the actual coordinates instead of using the > matrix indexes? (Like in the MatLab function imwarp using argument RA if > that helps understanding) > > Thanks a lot, > > Amaury > > _______________________________________________ > scikit-image mailing list > scikit-image@python.org > https://mail.python.org/mailman/listinfo/scikit-image _______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image