2

I would like to do some image manipulation with Python. I noticed some advanced algorithms which PIL lacks, e.g., Shepard's distortion, were provided by Image Magick.

The latest Python binding for Image Magick, as recommended here, is Wand. The API and documents are indeed well considered.

However, after browsing the doc, I found that the available functionality seemed to be very limited (rotation, flip, resize, crop, etc.).

Is it possible to do something like Shepard's distortion with Wand? Am I missing something?


EDIT

One can always fall back to subprocess and Image Magick's command line interface (for single step operation).

Community
  • 1
  • 1
herrlich10
  • 6,212
  • 5
  • 31
  • 35
  • If you are willing to consider another library, ``scikit-image`` includes generic warping functionality: http://scikit-image.org/docs/dev/auto_examples/plot_swirl.html (You simply have to specify a function that does the coordinate transformation.) – Stefan van der Walt Sep 18 '13 at 18:06
  • Thanks, @StefanvanderWalt. I'm looking for a Python alternative to Image Processing Toolbox in Matlab. scikit-image looks great! Nevertheless, I find Image Magick's control points based approach very straightforward. – herrlich10 Sep 19 '13 at 15:15
  • We have all the machinery in place to do the warping, we just need to figure out the exact function. If you are interested, I'd gladly help you to get this implemented and included in the package. – Stefan van der Walt Sep 19 '13 at 19:14
  • `skimage.transform.warp()` is very handy indeed! I've learnt to implement a function for spherize distortion following the tutorial @StefanvanderWalt linked. But there seems to be a bug in warp() at image border (issue submitted in github). – herrlich10 Oct 24 '13 at 06:07

1 Answers1

0

well it seems very late for this , Anyhow, current version 0.6.6 allows use of shepards distortion

 with Image.from_array(t) as face:
        face.artifacts['shepards:power'] = '1'
        face.distort('shepards', coordinates)
        self.image_output = cv2.cvtColor(np.array(face), cv2.COLOR_RGB2BGR)
        face.close()