In this assignment, i implement the warp equation given in the Ph.D. thesis by Leonard McMillan. The results are as follows:
This is the front view of
my scanned face.
This is rendered from left
side.
This is rendered from left
bottom corner.
This is rendered from bottom
side.
This is rendered from right
bottom corner.
This is rendered from right
side.
This is rendered from right
top corner.
This is rendered from top
side.
This is rendered from left
top corner.
These two are render from
left and right profile view.
The noise on my nose might be caused by the inaccurate depth informaion.
I wrote the codes using Visual C++6.0. The executable file warp.exe
is under ./asst2/warp/Release of my course directory. The codes under ./asst2/warp/mystuff
are kernal warping codes. The rest files under ./warp are the UI codes
generated by Visual C++. The user could rotate around the object by pressing
left mouse button down and dragging it. The user could also come closer,
go far away, zoom in, zoom out, or take a picture by simply clicking a
certain button on the frame window. The speed of my program is REAL TIME.
The drawback is that i use the ascii file generated by Paul's codes.
I used McMillan's method to determine visibility. I treated each pixel
as a square to fill hole. To be more specific,
if (x,y) (x+1,y) (x,y+1) (x+1,y+1) are four pixels with colors c0,
c1, c2, c3, and their corresponding positions in new image plane are (u0,v0)
(u1,v1) (u2,v2) (u3,v3), I use the following codes to fill the hole:
/********
glMatrixMode(GL_PROJECTION);
glOrtho2D(l,r,b,t);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,r-l,t-b);
//disable the depth value and determine visibility by the order of scaning
glDepthFunc(GL_ALWAYS);
glBegin(GL_QUADS);
// begin scaning,
// for each pixel, get new position by using warping equation;
// and using incremental method to accelerate the speed.
//then fill hole as follows:
{
glColor3ubv(c0); glVertex2d(u0,v0);
glColor3ubv(c1); glVertex2d(u1,v1);
glColor3ubv(c2); glVertex2d(u2,v2);
glColor3ubv(c3); glVertex2d(u3,v3);
}
glEnd();
********/