1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
(this README was written by A Mennucci, Mar 2001, Dec 2003, Apr 2005)
hi
the code in libmorph is
Written and Copyright (C) 1994-2000 by Michael J. Gourlay
Written and Copyright (C) 2000-2005 by Andrea Mennucci
libmorph contains the code to:
handle images with colors in rrr..ggg...bbb.. ordering
load and save images in TGA format (although 'save' is rumored to not work ok)
meshes: load, save, change, copy, backup, ....
warp images, according to the George Wolberg's "Digital Image Warping"
IEEE Computer Society Press order number 1944
(with changes by A.M., in dec 2003)
there is no explicit documentation, but the code is well commented and
easy to use
libmorph DOESN'T contain the code to:
view and edit meshes using GTK+ : this is contained in 'gtkmorph/mesh-gtk.c'
view and edit meshes using X toolkits : this is in 'xmorph/morph_cb.c'
otherwise libmorph would have to be linked to the specific libraries
--------
here is a list of most important features and improvements
--- warp2.c warp2.h
AM: I have introduced a new call
void
warp_image_versatile
(const unsigned char *src,
int s_width, int s_height, int s_channels, int s_rowstride,int s_xstride,
unsigned char *dst,
int d_width, int d_height, int d_channels, int d_rowstride,int d_xstride,
const double *xs, const double *ys, const double *xd, const double *yd,
int mesh_width, int mesh_height)
that can warp images of different sizes, with colors, with any
arrangment of data in memory (not only RRRGGGBBB but also RGBRGB.. );
moreover, with the old code, you had to use meshes were the border of the mesh
was on the border of the image; with this, you don't (the mesh can even go
outside the image)
summarizing: warp_image_versatile can warp any image
that has 8 bits per color, and is not indexed
there are other APIs for the same functions, such as
void
warp_image_a_m
(const unsigned char *src,
int s_width, int s_height, int s_channels, int s_rowstride,int s_xstride,
unsigned char *dst,
int d_width, int d_height, int d_channels, int d_rowstride,int d_xstride,
MeshT *srcmesh, MeshT *dstmesh);
and moreover...
--- warp-gtk.h
If you use gtk2.0 or gdk-pixbuf, then you will love this call
void warp_image_gdk_m
( GdkPixbuf *src, GdkPixbuf *dst,
MeshT *srcmesh, MeshT *dstmesh)
that wraps up the previous one (it simply uses the control parameters
of the src and dst to fill in the correct values for warp_image_versatile
--- resample.h
this new warping code has also many different antialiasing filters; the call
void mesh_resample_choose_aa_by_name(char *s);
decides which one the warping code will use, in this list (from resample.c)
"near_neighbor" , //choose nearest pixel: fastest, looks bad
"bilinear", //bilinear: same as with the old libmorph warping code
"lanczos", //Lanczos: much better quality, a must for animations
//and/or fine grained images; it is though slower,
"lanczos4",// even better than before, but no noticeable difference on
// most images
--- varia in mesh.c mesh.h
various routines to access data in the meshes (I like them better than
accessing the arrays themselves: it makes for more clean programming)
--- mesh labels
to any point in the mesh there is an associate label (an integer)
this is good for labeling and selecting (and it is used in gtkmorph)
for example, the smoothing routines in relax.c do not move selected points
---mesh-getext.h
reading data in meshes so that the mesh is implicitely extended infinitely
(by mirroring it at the border)
--- relax.c
this routines smooths meshes, with elastic energy or thin plate spline
energy
--- Ref counting
I have modified the meshes code in libmorph to use reference counting
this is good for porting libmorph in python (or any language that
needs garbage collecting) or for easier use in GTK .
this way, a program should call meshAlloc(this) to alloc a mesh, but
call meshUnref(this) to free it.
For this reason the function meshFree is deprecated.
if a program doesnt use reference counting (xmorph doesnt) and uses
meshFree then it should define NDEBUG_LIBMORPH_REF_COUNT or NDEBUG to
avoid the warning
if a program defines
#define LIBMORPH_STRICTLY_REF_COUNT
then the function meshFree will abort if the reference counting is not zero
----
|