Graphics Reference
In-Depth Information
//====================================================================
//XY structure
typedef struct xy_struct {
float x,y;
}xy_td;
//FEATURE
// line in image1: p1,p2;
// line in image2: q1,q2
// weights used in mapping: a,b,p
// length of line in image2
typedef struct feature_struct {
xy_td p1,p2,q1,q2;
float a,b,p;
float plength,qlength;
}feature_td;
//FEATURE LIST
typedef struct featureList_struct {
int num;
feature_td *features;
}featureList_td;
// --------------------------------------------------------------
// MORPH
// --------------------------------------------------------------
void morph(featureList_td *featureList)
{
Float a,b,p,plength,qlength;
xy_td p1,p2,q1,q2;
xy_td vp,wp,vq,wq,v,qq;
int ii,jj,indexI,indexD;
float idisp,jdisp;
float t,s,vx,vy;
float weight;
char background[3];
background[0] = background[1] = background[2] = 120;
for (int i=0; i<HEIGHT; i++) {
for (int j=0; j<WIDTH; j++) {
weight = 0;
idsp = jdsp = 0.0;
for (int k=0; k<featureList->num; k++) {
// get info about kth feature line
a = featureList->features[k].a;
b = featureList->features[k].b;
p = featureList->features[k].p;
p1 = featureList->features[k].p1;
p2 = featureList->features[k].p2;
q1 = featureList->features[k].q1;
q2 = featureList->features[k].q2;
plength = featureList->features[k].plength;
qlength = featureList->features[k].qlength;
FIGURE 4.51
Code using feature lines to morph from source to destination image.
Continued
 
Search WWH ::




Custom Search