Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Warps an image according to a user supplied triangular mesh. |
last modified: December 09, 2023
USAGE: meshwarp -f file [-i] [-p] infile outfile
-f ... file ....... textfile containing src and dst x,y control point pairs PURPOSE: To warp an image according to a triangular mesh. DESCRIPTION: MESHWARP warps an image according to a user supplied triangular mesh. The mesh list src and dst x,y control points per line. Then a list of triangle vertex indices is listed one triangle per line. This script may be used to simply warp part or all of an image or to warp one image to match another. ARGUMENTS: -f file ... FILE is a text file containing first a pair of scr and dst x,y control points separated by a space. The following that is a list of 3 comma separate triangle vertex indices. Vertex indices start at 0 and reference the corresponding pair of src and dst x,y control points. -i ... Enable the listing to the terminal of number of src, dst and triangles extracted from the file. -p ... Enable the listing to the terminal of the triangle numbers as the triangles are processed. Note: the script may be rather slow due to the processing of each triangle one-at-a-time. CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Textfile With Control Points and Triangle Vertex Indices |
---|
Original Image |
![]() |
|
Arguments: -f meshwarp_data.txt |
![]() |
|
Input vs Output Animation |
![]() |
|
Input Image With Blue SRC Trianglulation |
![]() |
|
Input Image With Blue SRC And Red DST (and Purple Overlapping) Trianglulation |
![]() |
|
Output Image With Red DST Trianglulation |
![]() |
What the script does is as follows:
This is equivalent to the following IM commands.
|