Wei Cheng
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 2D Projective transformations ###### tags: `cvdl2020` 2D projective geometry is the study of properties of the projective plane $P^2$ that are invariant under a group of transformation known as **projectivities**. That is, an invertible mapping from points in $P^2$ to points in $P^2$ that maps lines to lines. :::success A projectivity is an invertible mapping $h$ from $P^2$ to itself such that three points $x_1, x_2, x_3$ lie on the same line if and only if $h(x_1),h(x_2),h(x_3)$ do. ::: A formal mathematical definition is math would be :::success A mapping $h: P^2 \rightarrow P^2$ is a projectivity if and only if there exists a non-singular 3x3 matrix $H$ such that, for any point in $P^2$ represented by a vector $x$, it's true that $h(x)=Hx$ ::: Any points in $P^2$ is represented by a homogeneous 3-vector $x$, and $Hx$ is a linear mapping of homogenoeous coordinates. :::success In short, Any **invertible** linear transformation of homogeneous coordinates is a **projectivity**. ::: :::success Projectivities form a **group(群)** since the inverse of a projectivity is also a projectivity, and so is the composition of two projectivities. ::: ### Projective transformation (=Perspective transform) A planar projective transformation is a linear transformation on homogeneous 3-vector represented by a **non-singular** 3x3 matrix. $$ \begin{pmatrix} x_1' \\ x_2' \\ x_3' \\ \end{pmatrix} = \begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & h_{33} \\ \end{bmatrix} \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ \end{pmatrix} $$ or briefly, $$x'=Hx$$ Notice that the matrix H in this equation maay be changed by multiplication by an arbitrary non-zero scale factor without altering the projective transformation. :::info Both $x$ and $x'$ are homogeneous coordinate so $x$ can **absorb** any scaling factor derived from matrix $H$ $$ H \sim \begin{bmatrix} h_{11}/h_{33} & h_{12}/h_{33} & h_{13}/h_{33} \\ h_{21}/h_{33} & h_{22}/h_{33} & h_{23}/h_{33} \\ h_{31}/h_{33} & h_{32}/h_{33} & 1 \\ \end{bmatrix} $$ ::: Consqeuently, we say that H is a **homogeneous matrix**. There're **8** independent ratios among the **9** elements of $H$, and it follows that a projective transformation has **8 dof**. ### Example: Removing the projective distortion from a perspective image of a plane Shape is distorted under perspective imaging. In general, parallel lines on a scene place aren't parallel in the image but instead converge to a finite point. It's possible to undo the projective transformation by computing the inverse transformation and applying it to the image. The process is as follow: Selecting a section of image corresponding to a planar section of the world. Let the inhomogeneous coordinate of a pair of matching points $x$ and $x'$ in the world and image place be $(x,y)$ and $(x',y')$ respectively. The projective transformation can be written in inhomogeneous form as: $$ \begin{pmatrix} x_1' \\ x_2' \\ x_3' \\ \end{pmatrix} = \begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & h_{33} \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} = \begin{bmatrix} x h_{11} + y h_{12} + h_{13} \\ x h_{21} + y h_{22} + h_{23} \\ x h_{31} + y h_{32} + h_{33} \\ \end{bmatrix} $$ $$ x' = \frac{x_1'}{x_3'} = \frac{ h_{11} x + h_{12} y + h_{13} }{ h_{31} x + h_{32} y + h_{33} } \\ y' = \frac{x_2'}{x_3'} = \frac{ h_{21} x + h_{22} y + h_{23} }{ h_{31} x + h_{32} y + h_{33} } \\ $$ Each point correspondence $(x,y)$ <-> $(x',y')$ generates two equations for the elements of $H$ as follow: $$ x' ( h_{31} x + h_{32} y + h_{33} ) = h_{11} x + h_{12} y + h_{13} \\ y' ( h_{31} x + h_{32} y + h_{33} ) = h_{21} x + h_{22} y + h_{23} \\ $$ Notice that these are linear equations for elemnts in $H$. **4** point of correspondence lead to **8** of such linear equations in the entries of $H$, which are sufficient to solve $H$ (since $H$ has 8 dof) up to an insignificant multiplicatiev factor. The only restriction is that the 4 points must be in "general position", which means that not 3 points are collinear. The inverse of the transformation $H$ computed in this way is then applied to the whole image to undo the effect of perspective distortion on the selected plane. Remarks concerning this example are: - The computation of the rectifying transformation $H$ in this way does not require knowledge of **any** of the camera's parameters or the pose of the plane - It's not necessary to know coordinates for **4** points in order to remove projective distortion. Other methods require less points of correspondence. ### Transformation of lines Given $x_1,x_2,x_3$ lie on a line $l$ so $l^T x_i = 0 \ \forall i=1,2,3,...$. Let $H$ be a non-singular 3x3 matrix, and $Hx_i$ be the set of points being transformed. Then, one can verify that all points lies on a transformed line $l' = H^{-T}l$ since $l'^T \ Hx_i = (H^{-T}l)^T \ Hx_i = l^T \ H^{-1} \ Hx_i = 0$ :::success Under the point transformation $x'=Hx$, a line will be transformed as $l'=H^{-T} \ l$ ::: :::info Point transform: $x'=H \ x$ Line transform: $l'=H^{-T} \ l$ ::: ### Hierarchy of transformation ![](https://i.imgur.com/qqr9kJo.jpg) #### Isometries Isometries are transformations of the plane $R^2$ that preserve the **Euclidean distance**. - Orientation-preserving transformation Also called **Euclidean transformation**, is a composition of translation and rotation. $$ \begin{pmatrix} x' \\ y' \\ 1' \\ \end{pmatrix} = \begin{bmatrix} cos \theta & sin \theta & t_x \\ sin \theta & cos \theta & t_y \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} $$ Or can be written in the following form: $$ x' = H_{E} = \begin{bmatrix} R & t \\ 0^T & 1 \\ \end{bmatrix} x $$ where $R$ si rotation matrix such that $RR^T=R^TR=I$, and $|R|=1$, $t$ is a translation 2-vector - Orientation-reversing $$ \begin{pmatrix} x' \\ y' \\ 1' \\ \end{pmatrix} = \begin{bmatrix} -cos \theta & sin \theta & t_x \\ -sin \theta & cos \theta & t_y \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} $$ :::info An isometry is orientation-preserving is the upper left hand 2x2 matrix has determinant 1. Orientation-preserving isometrics form a **group**, orientation-reversing ones **does not**. ::: #### Similarity transformations A similarity transform is an isometry composed with an isotropic scaling. It's also called **equi-form** transformation because it preserves **shape** $$ \begin{pmatrix} x' \\ y' \\ 1' \\ \end{pmatrix} = \begin{bmatrix} s cos \theta & s sin \theta & t_x \\ s sin \theta & s cos \theta & t_y \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} $$ $$ x' = H_{S} = \begin{bmatrix} sR & t \\ 0^T & 1 \\ \end{bmatrix} x $$ #### Affine transformations An affine transform is a non-singular linear transformation followed by a translation. $$ \begin{pmatrix} x' \\ y' \\ 1' \\ \end{pmatrix} = \begin{bmatrix} a_{11} & a_{12} & t_x \\ a_{21} & a_{22} & t_y \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} $$ $$ x' = H_{A} = \begin{bmatrix} A & t \\ 0^T & 1 \\ \end{bmatrix} x $$ The affine matrix A can always be decomposed as $$A = R(\theta)R(-\phi)DR(\phi)$$ where $R(\theta)$ and $R(\phi)$ are rotations by $\theta$ and $\phi$ respectively, and D is a diagonal matrix $$D = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \\ \end{bmatrix} $$ This decomposition comes from SVD where $A=UDV^T=(UV^T)(VDV^T)=R(\theta)(R(-\phi)DR(\phi))$ where $U,V$ are othogonal matrices. :::info The essence of an affinity is the scaling in orthogonal directions, oriented at a particular angle. ::: A affinity is orientation-preserving or reversing acccording to whether $det(A)$ is positive or negative respectively. Since $det(A)=\lambda_1 \lambda_2$ this property depends only on the sign of the scalings. #### Perspective transformations It's a general non-singular linear transformation of **homogeneous** coordinates. $$ \begin{pmatrix} x' \\ x' \\ 1 \\ \end{pmatrix} = \begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & h_{33} \\ \end{bmatrix} \begin{pmatrix} x \\ y \\ 1 \\ \end{pmatrix} $$ $$ x' = H_{P} = \begin{bmatrix} A & t \\ v^T & 1 \\ \end{bmatrix} x $$ The matrix has nine elements with only thrie ratio significant, so the transformation is specified by eight parameters. A projective transformation can be decomposed into a chain of transformations (not unique), where each matrix in the chain represents a transformation higher in the hierarchy than the previous one. $$ H = H_{S}H_{A}H_{P} = \begin{bmatrix} sR & t \\ 0^T & 1\\ \end{bmatrix} \begin{bmatrix} K & 0 \\ 0^T & 1\\ \end{bmatrix} \begin{bmatrix} I & 0 \\ v^T & \mu\\ \end{bmatrix} = \begin{bmatrix} A & t \\ v^T & \mu\\ \end{bmatrix} $$ ### The line at infinity (affine transform) Under a projective transformation line at infinity $l_{\infty}$ are mapped to a finite line. However, if the transformation is an **affinity**, then **$l_{\infty}$ is not mapped to a finite line, but remains at infinity**. This is evident directly from the line transformation: $$l^{'}_{\infty} = H_{A}^{-T} l_{\infty} = \begin{bmatrix} A^{-T} & 0 \\ -t^T A^{-T} & 1 \\ \end{bmatrix} \begin{pmatrix} 0 \\ 0 \\ 1 \\ \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 1 \\ \end{pmatrix} = l_{\infty} $$ ![](https://i.imgur.com/j1nKbXy.jpg) :::success The line at infinity $l_{\infty}$ is a fixed line under the projective transformation H if and only if H is an **affinity**. :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully