CS4670/5670: Computer Vision, Spring 2015
Project 4: Single View Modeling
To Do
These are the routines that you'll write:
svmmath.cpp:
-
BestFitIntersect(const std::list &lines)
Compute the best intersection point of 3 or more lines in a least squares sense.
Here is a
write-up
for a recommended method that extends the cross-product method discussed in
class to return the best intersection point of 3 or more lines in a least
squared sense.
- 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.
-
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.
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 slides 15, 16). Also, your work on the written part of this project should inform what you do here.
-
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. A
special case of this is a point on the reference plane. In this case,
the reference homography H can be used to compute its 3D position. You should
be able to use your work from the written part of this project to inform what you do here.
More generally, see the man on the box slide from lecture (Projective
Geometry slide 16), where the given reference point is t1,
the new point is m0, and you want to compute the point
b0 (once you have b0, you can compute its X
and Y positions using H). Note that the man is not used here,
we're only interested in a point on the box. You may use vz
instead of t0 to help find b0. While you're not given the image position of b1, you can compute it from its 3D coordinates (knowing it has the
same X-Y coords as t1 and is on the ground), using H-1.
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
April 7, 2015