{ "cells": [ { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "*************************\n", "More Single View Geometry\n", "*************************" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(i) Homography from a World Plane\n", "=================================\n", "\n", "(a)\n", "---\n", "\n", "Estimating :math:`\\mathtt{H}` is equivalent to a homography estimation, which\n", "can only recover (8.1) up to an unknown scale factor :math:`\\lambda`:\n", "\n", ".. math::\n", "\n", " \\mathtt{H} =\n", " \\lambda \\mathtt{K}\n", " \\begin{bmatrix} \\mathbf{r}_1 & \\mathbf{r}_2 & \\mathbf{t} \\end{bmatrix}.\n", "\n", "Given the intrinsics :math:`\\mathtt{K}`, the camera pose may be computed from\n", "\n", ".. math::\n", "\n", " \\lambda^{-1} \\mathtt{K}^{-1} \\mathtt{H} =\n", " \\begin{bmatrix} \\mathbf{r}_1 & \\mathbf{r}_2 & \\mathbf{t} \\end{bmatrix}.\n", "\n", "Its scale ambiguity is resolved by constraining the solution such that\n", "\n", ".. math::\n", "\n", " \\left\\Vert \\lambda^{-1} \\mathtt{K}^{-1} \\mathtt{H} \\right\\Vert_F = 1\n", " \\implies\n", " \\begin{bmatrix} \\mathbf{r}_1 & \\mathbf{r}_2 & \\mathbf{t} \\end{bmatrix} =\n", " \\pm \\frac{\n", " \\mathtt{K}^{-1} \\mathtt{H}\n", " }{\n", " \\left\\Vert \\mathtt{K}^{-1} \\mathtt{H} \\right\\Vert_F\n", " }.\n", "\n", "The remaining two-fold (sign) ambiguity cannot be resolved because the\n", "perspective division (i.e. the homogeneous scaling factor) removes the effects\n", "of :math:`\\pm`.\n", "\n", "(b)\n", "---\n", "\n", "Suppose :math:`\\mathtt{H}` is a homography between points on a world plane\n", ":math:`\\left( \\mathbf{n}^\\top, d \\right)^\\top` and the image.\n", "\n", ".. math::\n", "\n", " \\mathbf{x}\n", " &= \\mathtt{P} \\begin{bmatrix} \\tilde{\\mathbf{X}}\\\\ 1 \\end{bmatrix}\\\\\n", " &= \\mathtt{K} \\mathtt{R} \\tilde{\\mathbf{X}} + \\mathbf{t}\\\\\n", " &= \\mathtt{K} \\mathtt{R} \\tilde{\\mathbf{X}} +\n", " \\mathbf{t} \\left( \\frac{-1}{d} \\mathbf{n}^\\top \\tilde{\\mathbf{X}} \\right)\n", " & \\quad & \\text{by (3.2), } \\mathbf{n}^\\top \\tilde{\\mathbf{X}} + d = 0\\\\\n", " &= \\mathtt{K} \\left(\n", " \\mathtt{R} - \\mathbf{t} \\mathbf{n}^\\top d^{-1}\n", " \\right) \\mathbf{\\tilde{X}}\\\\\n", " &= \\mathtt{H} \\mathbf{\\tilde{X}}" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(ii) Line Projection\n", "====================\n", "\n", "(a)\n", "---\n", "\n", "Any line containing the homogeneous camera centre :math:`\\mathbf{C}` can be\n", "written as a Plücker matrix\n", ":math:`\\mathtt{L} = \\mathbf{C} \\mathbf{A}^\\top - \\mathbf{A} \\mathbf{C}^\\top`\n", "(3.8). Here :math:`\\mathbf{A}` is any other point on that line.\n", "\n", "Suppose :math:`\\mathbf{a} = \\mathtt{P} \\mathbf{A}`. Then (8.2) reduces to\n", "\n", ".. math::\n", "\n", " \\mathtt{P} \\mathtt{L} \\mathtt{P}^\\top\n", " &= \\boldsymbol{0} \\mathbf{a}^\\top - \\mathbf{a} \\boldsymbol{0}^\\top\n", " & \\quad & \\mathtt{P} \\mathbf{C} = \\boldsymbol{0}\\\\\n", " &= \\left[ \\boldsymbol{0} \\times \\mathbf{a} \\right]_\\times\\\\\n", " &= \\mathbf{l}.\n", "\n", "(b)\n", "---\n", "\n", "Recall from result 3.5 that two lines :math:`\\mathcal{L}` and\n", ":math:`\\hat{\\mathcal{L}}` are coplanar and intersect if and only if the\n", "bilinear product of their Plücker line coordinates is zero:\n", "\n", ".. math::\n", "\n", " (\\mathcal{L} \\mid \\hat{\\mathcal{L}})\n", " &= l_{12} \\hat{l}_{34} + \\hat{l}_{12} l_{34} +\n", " l_{13} \\hat{l}_{42} + \\hat{l}_{13} l_{42} +\n", " l_{14} \\hat{l}_{23} + \\hat{l}_{14} l_{23}\n", " & \\quad & \\text{(3.13), (3.11)}\\\\\n", " &= 0.\n", "\n", "By (3.12), :math:`(\\mathcal{L} \\mid \\mathcal{L}) = 0`. Suppose\n", ":math:`\\hat{\\mathcal{L}} = \\sum_i^n x_i \\mathcal{L}^i` is a linear combination\n", "of :math:`n` other lines where :math:`\\mathbf{x} \\in \\mathbb{R}^n`.\n", "\n", ".. math::\n", "\n", " (\\mathcal{L} \\mid \\sum_i x_i \\mathcal{L}^i)\n", " &= l_{12} \\left( \\sum_i x_i l^i_{34} \\right) +\n", " \\left( \\sum_i x_i l^i_{12} \\right) l_{34} +\n", " l_{13} \\left( \\sum_i x_i l^i_{42} \\right) +\n", " \\left( \\sum_i x_i l^i_{13} \\right) l_{42} +\n", " l_{14} \\left( \\sum_i x_i l^i_{23} \\right) +\n", " \\left( \\sum_i x_i l^i_{14} \\right) l_{23}\\\\\n", " &= \\sum_i x_i\n", " \\left(\n", " l_{12} l^i_{34} + l^i_{12} l_{34} +\n", " l_{13} l^i_{42} + l^i_{13} l_{42} +\n", " l_{14} l^i_{23} + l^i_{14} l_{23}\n", " \\right)\\\\\n", " &= \\sum_i x_i (\\mathcal{L} \\mid \\mathcal{L}^i).\n", "\n", "Accordingly, the camera center :math:`\\mathbf{C}` lies on\n", ":math:`\\mathcal{L} = \\mathcal{P}^\\top \\mathbf{x}` if and only if\n", "\n", ".. math::\n", "\n", " \\mathcal{P} \\mathcal{L}\n", " &= \\begin{bmatrix}\n", " (\\mathbf{P}^2 \\land \\mathbf{P}^3 \\mid \\mathcal{L})\\\\\n", " (\\mathbf{P}^3 \\land \\mathbf{P}^1 \\mid \\mathcal{L})\\\\\n", " (\\mathbf{P}^1 \\land \\mathbf{P}^2 \\mid \\mathcal{L})\n", " \\end{bmatrix}\n", " & \\quad & \\text{(8.4), (8.3)}\\\\\n", " &= \\boldsymbol{0}.\n", "\n", "The last equality holds because :math:`\\mathtt{P} \\mathbf{C} = \\boldsymbol{0}`\n", "implies\n", "\n", ".. math::\n", "\n", " (\\mathbf{P}^i \\land \\mathbf{P}^j \\mid \\mathcal{L}) =\n", " x (\\mathbf{P}^i \\land \\mathbf{P}^j \\mid \\mathbf{P}^2 \\land \\mathbf{P}^3) +\n", " y (\\mathbf{P}^i \\land \\mathbf{P}^j \\mid \\mathbf{P}^3 \\land \\mathbf{P}^1) +\n", " z (\\mathbf{P}^i \\land \\mathbf{P}^j \\mid \\mathbf{P}^1 \\land \\mathbf{P}^2) = 0.\n", "\n", "By (3.14) and (6.13), the line :math:`\\mathcal{L}` goes through the image point\n", ":math:`\\mathbf{x}`.\n", "\n", "(c)\n", "---\n", "\n", "Each row of :math:`\\mathcal{P}` represents a line. The columns of each row\n", "describes the line's direction and moment :cite:`jia2017pcl`. They are not\n", "independent because they always satisfy the Klein quadric (3.12). Thus, the\n", "the columns of :math:`\\mathcal{P}` can be interpreted geometrically as a\n", "triangular pyramid, whose tip starts at :math:`\\mathbf{C}`, that intersects the\n", "image plane." ] }, { "cell_type": "raw", "metadata": { "collapsed": false, "raw_mimetype": "text/restructuredtext" }, "source": [ "(iii) Contour Generator of a Quadric\n", "====================================\n", "\n", "The contour generator :math:`\\boldsymbol{\\Gamma}` of a quadric consists of the\n", "set of points :math:`\\mathbf{X}` on :math:`\\mathtt{Q}` for which the tangent\n", "planes contain the camera center :math:`\\mathbf{C}`.\n", "\n", "The plane :math:`\\boldsymbol{\\pi} = \\mathtt{Q} \\mathbf{X}` is the polar plane of\n", ":math:`\\mathbf{X}` with respect to :math:`\\mathtt{Q}` (3.15). If\n", ":math:`\\mathbf{X}` lies on :math:`\\mathtt{Q}`, then\n", ":math:`\\boldsymbol{\\pi}` is the tangent plane to :math:`\\mathtt{Q}` at\n", ":math:`\\mathbf{X}`.\n", "\n", "In the case that :math:`\\mathtt{Q}` is non-singular and :math:`\\mathbf{X}` is\n", "outside the quadric, the polar plane is defined by the points of contact with\n", ":math:`\\mathtt{Q}` of the cone of rays through :math:`\\mathbf{X}` tangent to\n", ":math:`\\mathtt{Q}`. Hence, the condition that :math:`\\mathbf{C}` is on each\n", "tangent plane is :math:`\\boldsymbol{\\pi}^\\top \\mathbf{C} =\n", "\\mathbf{X}^\\top \\mathtt{Q} \\mathbf{C} =\n", "\\mathbf{X}^\\top \\boldsymbol{\\pi}_\\boldsymbol{\\Gamma} = \\boldsymbol{0}` (3.2).\n", "This implies that the contour generator of a quadric is a plane curve, and that\n", "the plane of :math:`\\boldsymbol{\\Gamma}` is the polar plane of the camera center\n", "with respect to the quadric." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(iv) Apparent Contour of an Algebraic Surface\n", "=============================================\n", "\n", "An algebraic surface of order :math:`n` is a set of points in Euclidean space\n", "whose homogeneous coordinates satisfy\n", "\n", ".. math::\n", "\n", " F^n(\\mathbf{X}) = 0\n", "\n", "where :math:`F^n` is a polynomial of degree :math:`n` :cite:`gorjanc2015as`. By\n", "inspection, an algebraic surface of the first order is a plane.\n", "\n", "An order of an algebraic surface equals the number of intersections with any\n", "line in the space that does not lie on this surface. The points of intersection\n", "can be real or complex. A set of points that belong to a surface and to a plane\n", "are called intersection points of the surface and the plane. Every plane\n", "intersection of an algebraic surface is a plane algebraic curve. Therefore,\n", "the order of an algebraic surface equals the order of any plane intersection of\n", "that surface.\n", "\n", "A dual notion of the order of a surface is the class of the surface. A class of\n", "an algebraic surface equals the number of its tangent planes that pass through\n", "any line in the space that does not lie on the surface. If the order and the\n", "class of a surface equal :math:`n`, the surface is of the\n", ":math:`n^\\text{th}` degree.\n", "\n", "Recall that the gradient :math:`\\nabla F^n` points in the direction of steepest\n", "ascent and is orthogonal to the tangent plane :cite:`djoycedd`. The plane\n", "tangent to the surface at a point on the contour generator must pass through the\n", "camera center point by definition 8.8. By (3.2),\n", "\n", ".. math::\n", "\n", " \\mathbf{C} \\cdot \\nabla F^n = 0\n", "\n", "where :math:`\\mathbf{C}` is the camera center.\n", "\n", "Suppose the homogeneous algebraic surface is of degree :math:`n`. As a result\n", "of the preceding definition, the tangent plane is a surface of degree\n", ":math:`n - 1`. By Bézout's theorem, the apparent contour is a curve of degree\n", ":math:`n (n - 1)` :cite:`forsyth1996recognizing`." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. __hartley2004-ex-8.v:\n", "\n", "(v) Rotation Axis Vanishing Point for :math:`\\mathtt{H} = \\mathtt{K} \\mathtt{R} \\mathtt{K}^{-1}`\n", "================================================================================================\n", "\n", "Suppose a projective transformation between two planes has the form\n", "\n", ".. math::\n", "\n", " \\mathtt{H} = \\mathtt{T} \\mathtt{R} \\mathtt{T}^{-1}\n", "\n", "with :math:`\\mathtt{T}` a general projective transformation; then\n", ":math:`\\mathtt{H}` is a conjugate rotation (A7.1). Its\n", ":ref:`eigenvalues ` are preserved up to a common scale.\n", "This last property is why :math:`\\mathtt{T} \\mathbf{a}` is an eigenvector of\n", ":math:`\\mathtt{H}`, where :math:`\\mathbf{a}` is the direction of the rotation\n", "axis. When :math:`\\mathtt{T} = \\mathtt{K}`, the derivation before result 8.20\n", "illustrates that :math:`\\mathbf{v} = \\mathtt{K} \\mathbf{a}` is the vanishing\n", "point of the rotation axis." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(vi) Synthetic Rotations\n", "========================\n", "\n", "As explained in section 8.4.2, a pure rotation can be represented as a\n", ":ref:`conjugate rotation `\n", ":math:`\\mathtt{H} = \\mathtt{K} \\mathtt{R} \\mathtt{K}^{-1}`. Its\n", ":ref:`eigendecomposition ` is given by\n", ":math:`\\mathtt{H}(\\theta) =\n", "\\mathtt{U} \\mathop{\\mathrm{diag}}\\left(1, e^{i \\theta}, e^{-i \\theta} \\right)\n", "\\mathtt{U}^{-1}`. Consequently,\n", "\n", ".. math::\n", "\n", " \\mathtt{H}^{\\lambda} =\n", " \\mathtt{U}\n", " \\mathop{\\mathrm{diag}}\\left(\n", " 1, e^{i \\lambda \\theta}, e^{-i \\lambda \\theta}\n", " \\right) \\mathtt{U}^{-1} =\n", " \\mathtt{K} \\mathtt{R}(\\lambda \\theta) \\mathtt{K}^{-1}\n", "\n", "is the conjugate of a rotation through angle :math:`\\lambda \\theta`. This\n", "representation can be used to generate synthetic images rotated through any\n", "angle :math:`\\phi = \\lambda \\theta`. The images are interpolated between the\n", "original images (if :math:`0 < \\phi < \\theta`), or extrapolated\n", "(if :math:`\\phi > \\theta`)." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(vii) Imaged Circular Points of a Perspectively Imaged Plane\n", "============================================================\n", "\n", "imaged circular points of a perspectively imaged plane may be\n", "computed if any of the following are on the plane\n", "\n", "page 5, top half of 6, 48-57\n", " 2.7.3?\n", " 2.7.5\n", " example 2.26***\n", " example 2.27***\n", "\n", "chapter 2 iv.c\n", " not that relevant\n", "\n", "page 79, 80 - 82\n", " (3.21)\n", "\n", "page 208-220, 224-233\n", "\n", "result 8.17\n", "(8.8)\n", "\n", " It was seen in chapter 3 that a plane π intersects π∞ in a line, and this line\n", "intersects Ω∞ in two points which are the circular points of π. The imaged\n", "circular points lie on ω at the points at which the vanishing line of the plane π\n", "intersects ω.\n", "\n", "\n", "(a) Square Grid\n", "---------------\n", "\n", "maybe (8.10)\n", "\n", "result 8.19\n", "..maybe 8.6 vanishing points\n", " 8.6.2\n", "\n", "(b) Two Rectangles with Nonparallel Sides\n", "-----------------------------------------\n", "\n", "example 8.18\n", "\n", "(c) Two Circles of Equal Radius\n", "-------------------------------\n", "\n", "(d) Two Circles of Unequal Radius\n", "---------------------------------" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ "(viii) Image of the Absolute Conic with Zero Skew\n", "=================================================\n", "\n", "Recall from result 8.17 that the IAC is defined as\n", "\n", ".. math::\n", "\n", " \\boldsymbol{\\omega}\n", " &= \\begin{bmatrix}\n", " a & b / 2 & d / 2\\\\\n", " b / 2 & c & e / 2\\\\\n", " d / 2 & e / 2 & f\n", " \\end{bmatrix}\n", " & \\quad & \\text{(2.3)}\\\\\n", " &= \\mathtt{K}^{-\\top} \\mathtt{K}^{-1}\\\\\n", " &= \\mathtt{K}^{-\\top}\n", " \\begin{bmatrix}\n", " \\alpha_x^{-1} & \\frac{-s}{\\alpha_x \\alpha_y} &\n", " \\frac{s y_0}{\\alpha_x \\alpha_y} - \\frac{x_0}{\\alpha_x}\\\\\n", " 0 & \\alpha_y^{-1} & \\frac{-y_0}{\\alpha_y}\\\\\n", " 0 & 0 & 1\n", " \\end{bmatrix}\n", " & \\quad & \\text{(6.10)}\\\\\n", " &= \\begin{bmatrix}\n", " \\alpha_x^{-2} & 0 & \\frac{-x_0}{\\alpha_x^2}\\\\\n", " 0 & \\alpha_y^{-2} & \\frac{-y_0}{\\alpha_y^2}\\\\\n", " \\frac{-x_0}{\\alpha_x^2} & \\frac{-y_0}{\\alpha_y^2} &\n", " 1 + \\frac{x_0^2}{\\alpha_x^2} + \\frac{y_0^2}{\\alpha_y^2}\n", " \\end{bmatrix}\n", " & \\quad & s = 0.\n", "\n", "A point :math:`\\mathbf{x} = (x, y, 1)` on the conic must satisfy\n", "\n", ".. math::\n", "\n", " 0 &= \\mathbf{x}^\\top \\boldsymbol{\\omega} \\mathbf{x}\n", " & \\quad & \\text{(2.2)}\\\\\n", " &= a x^2 + bxy + cy^2 + dx + ey + f\\\\\n", " &= \\frac{x^2}{\\alpha_x^2} + \\frac{y^2}{\\alpha_y^2} -\n", " \\frac{2 x_0}{\\alpha_x^2} x - \\frac{2 y_0}{\\alpha_y^2} y +\n", " 1 + \\frac{x_0^2}{\\alpha_x^2} + \\frac{y_0^2}{\\alpha_y^2}\\\\\n", " &= 1 + \\frac{x^2 - 2 x_0 + x_0^2}{\\alpha_x^2} +\n", " \\frac{y^2 - 2 y_0 + y_0^2}{\\alpha_x^2}\\\\\n", " &= 1 + \\left( \\frac{x - x_0}{\\alpha_x} \\right)^2 +\n", " \\left( \\frac{y - y_0}{\\alpha_y} \\right)^2.\n", "\n", "Thus, the IAC may be interpreted as an ellipse aligned with the axes, centered\n", "on the principal point, and with axes of length :math:`i \\alpha_x` and\n", ":math:`i \\alpha_y` in the :math:`x` and :math:`y` directions respectively." ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. rubric:: References\n", "\n", ".. bibliography:: chapter-08.bib" ] } ], "metadata": { "anaconda-cloud": {}, "celltoolbar": "Raw Cell Format", "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 1 }