CS4670/5670: Computer Vision, Fall 2013

Project 4: Single View Modeling

Data Structures

svmAux.h, PriorityQueue.h: defines some auxiliary data structures and functions.

svm.h: defines the following important data structures:

struct SVMPoint {
    double u,v,w;
    double X,Y,Z,W;
    bool known();
};
typedef CTypedPtrDblList<SVMPoint> PointList;

where (u,v,w) is 2D Homogeneous Coordinates in image plane, and X, Y, Z, W are 3D Homogeneous Coordinates in 3D world. If w = 1, (u, v) is image coordinates, ranging from 0 to image width and 0 to image height respectively. If w=0 means the point is at infinity. Otherwise, (u/w, v/w) is  image coordinates. Similar means for X, Y, Z, W. 

known() returns true if the 3D position of this point is known, false otherwise.

struct SVMLine {
    int orientation;
    SVMPint *pnt1, *pnt2;
};
typedef CTypedPtrDblList<SVMLine> LineList;

where orientation indicates whether the line is supposed to be parallel to X, Y, Z axis or just any possible orientation in 3D. 

struct SVMPolygon {
    CTypedPtrDblList<SVMPoint> pntList;
    double cntx, cnty;
    double H[3][3], invH[3][3];
    char name[256];
};
typedef CTypedPtrDblList<SVMPolygon> PolygonList;

where each polygon consist of a list of SVMPoint and the pointers to the SVMPoints are saved in pntList. 

(cntx, cnty) is the mean of all points in the list, used for polygon selection in UI. H is the homography from normalized texture image of this polygon to the original image; that is, if the INVERSE of H is applied to the image coordinates (u,v,w) in the pntList, the result is the texture coordinates, ranging between [0,1]. invH is the inverse matrix of H. H is used when generating texture images from original image. invH is used to convert image coordinates in pntList to texture coordinates. Whenever you change H, please update invH using Matrix3by3Inv function in svmAux.h. 

name is the name of the polygon. name.gif will be used as texture file name for VRML file. If the polygon has a name "wall", the texture image name should be "wall.tga". "wall.tga" maybe contain something more than a wall, you want to use your scissor programming to cut the wall out of its background. Based on the mask from your scissor and wall.tga, you want to generate a wall.gif with Photoshop, in which background are transparent and the foreground are opaque. If you do this for all the polygons, and save the model as VRML. The skeleton code will generate a VRML file, using polygon's name with ".gif" extension as texture image filename. That's the reason use want to follow my naming convention: wall-->wall.tga-->wall.gif ! If you put the VRML file and all *.gif texture image files under the same directory, you can view it with a VRML viewer.

ImgView.cpp/h: defines and implements imgView class, which handles most of the UI messages and drawing routines. You will work with the following member data:

SVMPoint xVanish, yVanish, zVanish;
SVMPoint refPointOffPlane;
double H[3][3], Hinv[3][3];

xVanish, yVanish, zVanish are vanishing points for X, Y, Z axis, respectively.

refPointOffPlane is the point off of the reference plane that defines the reference height R, as described in lecture.

H is the homography from the reference plane to the image plane, and Hinv is the inverse of H.

vec/mat.h: utility functions for vector and matrix operations. Supports common operations such as +,-,*,/ in vector/matrix domain, as well as vector/matrix specific operations including cross product, inversion, etc. You will find these functions quite handy for the matrix and vector computations involved in this project.


Last modified November 8, 2013