These are the routines that you'll write:
ImgView.inl (part of ImgView.cpp to be filled in, in a separate file):
-
ImgView::sameXY()
Compute the 3D position of a new point that is
directly above another point whose 3D position is already known. See the
slides for measuring height (Projective Geometry slide 32, 33).
-
ImgView::sameZPlane()
Compute the 3D position of a new point that is
on the same plane as another point whose 3D position is already known. See
the man on the box slide from lecture (Projective Geometry slide 34, 35). A special case of this is a point
on the reference plane. In this case, the homography can be used instead
to compute its 3D coordinate.
svmmath.cpp:
- ComputeHomography(double H[3][3], double Hinv[3][3], const
vector<SVMPoint> &points, vector<Vec3d> &basisPts, bool isRefPlane)
Compute the homography H from the plane specified by
points to the image plane, as well as Hinv, the inverse of H.
This is used to compute the homography for the reference plane, as well as
the polygonal patches you create. In case of an arbitrary polygonal patch
in 3D space, you need to convert the coordinate system first.
See this document for a more detailed explanation.
-
BestFitIntersect(const std::list &lines)
Compute the best intersection point of 3 or more lines in a least squares
sense. See the note and helper code linked off the main page. This is
used to compute vanishing points by ImgView::computeVanishingPoints.
-
ConvertToPlaneCoordinate(const vector& points,
vector& basisPts, double &uScale, double &vSvale)
Convert the coordinate of points on the designated plane to the plane
coordinate system, as described in above mentioned
document. This is called from ComputeHomography to compute
homographies from polygonal patches you defined in the scene. Save
the final scales you apply to the u and v dimensions to the output
parameters uScale and vScale.
ImgViewBox.cpp:
- solveForOppositeCorners(double u0, double v0, double u2,
double v2, double &u1, double &v1, double &u3, double
&v3)
Given the 2D position of corners 0 and 2 on an XZ rectangle,
compute the 2D positions of the other two corners (with indices 1
and 3). You'll need to use the vanishing points and construct
various lines to find the points. The indexing of the corners is
shown here:
- solveForOppositeFace(SVMSweep *sweep, double imgX, double
imgY, Vec3d &p4_out, Vec3d &p5_out, Vec3d
&p6_out, Vec3d &p7_out)
Given the 2D positions of corners 0,1,2, and 3 on a box, compute
the 2D positions of the other four corners (with indices 4, 5, 6,
and 7). Again, you'll need to use the vanishing points and
construct various lines to find the points. The indexing of the
corners is shown here:
- find3DPositionsBox(SVMPoint *points[8])
Given the 2D position of all eight corners of a box (indexed
according to the previous image), and the 3D position of the anchor
(point 0), compute the 3D coordinates of all points. You will want to
first implement the sameXY and sameZPlane routines.
camera.cpp:
- computeCameraParameters()
Compute the position and projection matrix for the camera,
assuming the reference homography and reference height have already
been specified. See the main project page
for more information.
- invertScene(double zScale)
Invert the scene in order to create a reverse perspective image.
You'll need to compute a transformation for inverting the scene, as
described on the main project page. The
parameter zScale controls how deep the inverted scene will
be. Before inverting the scene, you first need to compute the camera
parameters.
Last modified
February 15, 2008