So searching old posts I can see that as of 2009 it was not possible to do rectangular grid warping in IM but that it was on the "wish list" of things to add. Is it possible at this time or are triangular solutions like Fred's meshwarp still the only viable option?
Thanks
Mesh/grid warping: Can it be done in IM?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Mesh/grid warping: Can it be done in IM?
See "-distort Shepards", http://www.imagemagick.org/script/comma ... hp#distort
snibgo's IM pages: im.snibgo.com
Re: Mesh/grid warping: Can it be done in IM?
Shepards was my first thought. I thought for sure it would do what I wanted but when I actually played with it I could not get it to do what I needed. I need to take a rectangular image and warp it and stretch it so that it can fit a UV map for a 3D image (specifically an unwrapped model of a horse which looks like a skin rug). Not really sure how to explain why/how Shepards was not working for me but I found that it warped the whole image just like Photoshops Free Transform: Warp tool. What what I am looking for is something more like Photoshops liquify tool or Fred's Meshwarp(http://www.fmwconcepts.com/imagemagick/ ... /index.php) only much more pronounced then his hamster example.
It is totally possible that I have misused Shepards though. Is that the method that was added to create true grid warping?
It is totally possible that I have misused Shepards though. Is that the method that was added to create true grid warping?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Mesh/grid warping: Can it be done in IM?
There is no meshwarp in IM, yet, besides my script. Shepards warp does an inverse distance weighting average. It is not a meshwarp.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Mesh/grid warping: Can it be done in IM?
shepards:power may be useful: http://www.imagemagick.org/Usage/distor ... ards_power
For mesh warping, I use a generalised barycentric method: include the 4 coners in the point set, triangulate, use barycentric coords to create a displacement map, and use that. It takes a fair bit of C-code to do this, but it is fast. Sadly not (yet) built in to IM.
For mesh warping, I use a generalised barycentric method: include the 4 coners in the point set, triangulate, use barycentric coords to create a displacement map, and use that. It takes a fair bit of C-code to do this, but it is fast. Sadly not (yet) built in to IM.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Mesh/grid warping: Can it be done in IM?
That is pretty much what I did in my script, though not very fast.snibgo wrote:shepards:power may be useful: http://www.imagemagick.org/Usage/distor ... ards_power
For mesh warping, I use a generalised barycentric method: include the 4 coners in the point set, triangulate, use barycentric coords to create a displacement map, and use that. It takes a fair bit of C-code to do this, but it is fast. Sadly not (yet) built in to IM.
Re: Mesh/grid warping: Can it be done in IM?
Thanks for the replies I appreciate it. That is pretty much what I figured. I will look more into barycentric/affine systems.