Assignment 2 : Projection and Homography

Similar documents
Pin Hole Cameras & Warp Functions

Image Formation. Antonino Furnari. Image Processing Lab Dipartimento di Matematica e Informatica Università degli Studi di Catania

Humanoid Robotics. Projective Geometry, Homogeneous Coordinates. (brief introduction) Maren Bennewitz

Agenda. Rotations. Camera models. Camera calibration. Homographies

Visual Recognition: Image Formation

1 Projective Geometry

Agenda. Rotations. Camera calibration. Homography. Ransac

Autonomous Navigation for Flying Robots

Pin Hole Cameras & Warp Functions

Homogeneous Coordinates. Lecture18: Camera Models. Representation of Line and Point in 2D. Cross Product. Overall scaling is NOT important.

Computer Vision. Coordinates. Prof. Flávio Cardeal DECOM / CEFET- MG.

Camera model and multiple view geometry

Geometric camera models and calibration

COSC579: Scene Geometry. Jeremy Bolton, PhD Assistant Teaching Professor

calibrated coordinates Linear transformation pixel coordinates

521466S Machine Vision Exercise #1 Camera models

CIS 580, Machine Perception, Spring 2015 Homework 1 Due: :59AM

Projective geometry for Computer Vision

Projective Geometry and Camera Models

Perspective projection and Transformations

Projective Geometry and Camera Models

Camera Model and Calibration

DD2423 Image Analysis and Computer Vision IMAGE FORMATION. Computational Vision and Active Perception School of Computer Science and Communication

Camera Calibration. Schedule. Jesus J Caban. Note: You have until next Monday to let me know. ! Today:! Camera calibration

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

Camera Projection Models We will introduce different camera projection models that relate the location of an image point to the coordinates of the

CSE 252B: Computer Vision II

3-D D Euclidean Space - Vectors

Calibrating an Overhead Video Camera

55:148 Digital Image Processing Chapter 11 3D Vision, Geometry

Image Transformations & Camera Calibration. Mašinska vizija, 2018.

Computer Vision Projective Geometry and Calibration. Pinhole cameras

Computer Vision I Name : CSE 252A, Fall 2012 Student ID : David Kriegman Assignment #1. (Due date: 10/23/2012) x P. = z

Structure from motion

Cameras and Radiometry. Last lecture in a nutshell. Conversion Euclidean -> Homogenous -> Euclidean. Affine Camera Model. Simplified Camera Models

BIL Computer Vision Apr 16, 2014

Transformations. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Geometry: Unit 1: Transformations. Chapter 14 (In Textbook)

3D Modeling using multiple images Exam January 2008

Module 6: Pinhole camera model Lecture 32: Coordinate system conversion, Changing the image/world coordinate system

Computer Vision cmput 428/615

Introduction to Homogeneous coordinates

Early Fundamentals of Coordinate Changes and Rotation Matrices for 3D Computer Vision

Instance-level recognition I. - Camera geometry and image alignment

Camera Model and Calibration. Lecture-12

MERGING POINT CLOUDS FROM MULTIPLE KINECTS. Nishant Rai 13th July, 2016 CARIS Lab University of British Columbia

Outline. ETN-FPI Training School on Plenoptic Sensing

521493S Computer Graphics Exercise 2 Solution (Chapters 4-5)

Single View Geometry. Camera model & Orientation + Position estimation. What am I?

Vision Review: Image Formation. Course web page:

COMP30019 Graphics and Interaction Perspective Geometry

Camera Models and Image Formation. Srikumar Ramalingam School of Computing University of Utah

CIS 580, Machine Perception, Spring 2016 Homework 2 Due: :59AM

CHAPTER 3. Single-view Geometry. 1. Consequences of Projection

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

Computer Vision, Assignment 1 Elements of Projective Geometry

Structure from motion

METRIC PLANE RECTIFICATION USING SYMMETRIC VANISHING POINTS

Interactive Computer Graphics. Hearn & Baker, chapter D transforms Hearn & Baker, chapter 5. Aliasing and Anti-Aliasing

2D transformations: An introduction to the maths behind computer graphics

Week 2: Two-View Geometry. Padua Summer 08 Frank Dellaert

COMP 558 lecture 19 Nov. 17, 2010

Introduction to Computer Vision

CS6670: Computer Vision

Pinhole Camera Model 10/05/17. Computational Photography Derek Hoiem, University of Illinois

Robotics - Projective Geometry and Camera model. Matteo Pirotta

3D Geometry and Camera Calibration

Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College

Agenda. Perspective projection. Rotations. Camera models

Lecture 1.3 Basic projective geometry. Thomas Opsahl

Short on camera geometry and camera calibration

Computer Vision I - Algorithms and Applications: Multi-View 3D reconstruction

N-Views (1) Homographies and Projection

3D Computer Vision II. Reminder Projective Geometry, Transformations. Nassir Navab. October 27, 2009

CSE152a Computer Vision Assignment 1 WI14 Instructor: Prof. David Kriegman. Revision 0

Viewing. Reading: Angel Ch.5

EXAM SOLUTIONS. Image Processing and Computer Vision Course 2D1421 Monday, 13 th of March 2006,

Rectification and Distortion Correction

Camera models and calibration

CS 563 Advanced Topics in Computer Graphics Camera Models. by Kevin Kardian

Lecture 8: Camera Models

Specifying Complex Scenes

Computer Vision Project-1

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

COMP30019 Graphics and Interaction Three-dimensional transformation geometry and perspective

Structure from Motion. Prof. Marco Marcon

ECE Digital Image Processing and Introduction to Computer Vision. Outline

3D Computer Vision II. Reminder Projective Geometry, Transformations

Perspective Projection in Homogeneous Coordinates

Perspective Projection [2 pts]

Hartley - Zisserman reading club. Part I: Hartley and Zisserman Appendix 6: Part II: Zhengyou Zhang: Presented by Daniel Fontijne

Two-View Geometry (Course 23, Lecture D)

Today s Agenda. Geometry

Computer Graphics 7: Viewing in 3-D

Last week. Machiraju/Zhang/Möller/Fuhrmann

Module 4F12: Computer Vision and Robotics Solutions to Examples Paper 2

55:148 Digital Image Processing Chapter 11 3D Vision, Geometry

Robotics - Projective Geometry and Camera model. Marcello Restelli

CV: 3D sensing and calibration

Transcription:

TECHNISCHE UNIVERSITÄT DRESDEN EINFÜHRUNGSPRAKTIKUM COMPUTER VISION Assignment 2 : Projection and Homography Hassan Abu Alhaija November 7,204 INTRODUCTION In this exercise session we will get a hands-on introduction to the basics of geometric transformation, projection and Homography. Those are the basics of image formation and are important to understand how the 3D real world is projected into the 2D images. This projection is a one-way transformation by nature due to loss of information and recovering 3D information back from 2D images is One of the main challenges in computer vision. we will introduce here a few of the basic concepts we are going to use.. HOMOGENEOUS COORDINATES In the 2D Euclidean space we usually represent a point P with two coordinates P = (x, y). This is called Euclidean coordinates R 2. We extend this representation by simply adding as a third coordinate and get the presentation of the point P = (x, y,). This is called Homogeneous Coordinates and denoted P 2. The same applies when moving from 3D Euclidean coordinates P = (x, y, z) R 3 to 3D homogeneous coordinates P = (x, y, z,) P 3 Euclidean to Homogeneous : (x, y) R 2 (x, y,) P 2 The reason we use Homogeneous coordinates is that it makes using matrix multiplication much easier to represent transformations. After applying all transformations on the point, we might end up with a Homogeneous coordinate vector that doesn t have z = as its last

component. Here we need to take care when moving back to the Euclidean coordinates to divide the other two coordinates x, ỹ by the last component z. Note that when the homogeneous coordinates are not normalized (divided by the last component) we annotate them with the tilde notation x, ỹ, z Homogeneous to Euclidean :.2 TRANSFORMATIONS ( x, ỹ, z) P 2 (x, y) R 2 where x = x z, y = ỹ z When working in Homogeneous coordinates, we can represent a geometric transformation of a point in d-dimensional P R d space by a matrix H R (d+) (d+). So for example when transforming 2D points x = (x, y,) we need a transformation matrix of size 3 3. We will take a look at some transformations (in 2D space) characterized by the properties of geometry they preserve..2. ISOMETRY TRANSFORMATION A transformation that preserve the distance between points is called an Isometry. This means that the distances between a group of points before and after the transformation stay the same. This includes Rotation and Translation of points. It can be written in matrix form as following : ( ) x R t = 0 T x where R is a 2 2 matrix, t is a translation 2D vector and 0 T is a vector of zeros..2.2 SIMILARITY TRANSFORMATION A Similarity transformation changes the distance between points but preserves the angles between points and lines. Also, two parallel lines before the transformation stay parallel after so it preserves the parallel property between lines. It includes rotation and translation but with a an isometric scale. That is the scaling with constant factor s in all directions. x = ( ) sr t 0 T x.2.3 AFFINE TRANSFORMATION In this transformation the angles between lines are not preserved any more. Instead the only property preserved is the parallel property between lines. This includes scaling with different factors along different axis and an additional rotation angle for the axis along which the scaling happens. 2

( ) x A t = 0 T x Where A is a 2 2 non-singular matrix that includes the two rotations and two scaling factors. it can be written as : A = R(α)(R( β)dr(β)) Where R(α) and R(β) are two rotation matrices for angles α and β. and D is the scaling matrix with two scaling factors λ on x-axis and λ 2 on y-axis. ( ) λ 0 D = 0 λ 2.2.4 PROJECTIVE TRANSFORMATION Projective transformation, also called a Homography, is the most general Transformation in sense of the properties it affects. Here the only property preserved is the linearity, meaning that straight lines stay straight after the Projective transformation (this is actually the weakest condition for a matrix to be called a transformation). While the angles, distance and parallelness all can change. This can be seen as a mixture of all the previous transforms. While all the other transformations are applied the same to all points regardless of their position, the projective transformation adds the property of having different transformation according to the position of the point in space. This is done through the vector v T which replaces the 0 T in other transformation matrices. Here we can see the advantage of using homogeneous coordinates for doing this transformation. ( ) x A t = v T x v Figure.: Transformation applied to a rectangle.3 CAMERA AND PERSPECTIVE PROJECTION Cameras in computer vision is devices that project the 3D world points into a 2D image plane. The most simple and common camera model is the Pinhole camera. In this model the image is formed on a plane set behind an infinitely small pinhole that allows only a single ray of 3

light from each point in the scene to pass through it. The simplicity of this model comes from ability to characterize this camera by only one number which is the focal length f which is the distance from the whole to the image plane. Figure.2: Pinhole camera model The Perspective Projection is computing the projection of a 3D scene point P = (X,Y, Z,) on the image plane as p = (x, y,) using the 3 4 camera matrix C. In this case of pinhole camera the matrix C is very simple. X x x f 0 0 0 y = ỹ = 0 f 0 0 Y Z z 0 0 0 Extending this simple pinhole camera into digital imaging needs some modifications. First the focal f in this case is in real world units (meters) and so the coordinates of projection x, y are also in meters. In digital images we need those coordinates in pixels (u, v) instead. For this conversion, we need the size of pixel in meters ρ and we can divide the focal length by it to move to pixel units. this gives us α = f ρ. The other modification we need is moving the center of coordinates. While in the pinhole camera case the center of coordinates is considered at the center of the image (behind the pinhole), in digital images the coordinates start from the upper left corner. For that we need a translation of amount (u 0, v 0 ) which is the distance from the corner to the center in pixels. After applying those modifications, we get our intrinsic camera parameters matrix K. This matrix has a total of 3 parameters and stays constant for the same camera regardless of its or object s position and rotation. α 0 u 0 K = 0 α v 0 0 0 4

The last ingredient we need is the extrinsic camera parameters matrix which represent the current status of the camera in the 3D scene. This is a 3 4 matrix that contains the 3 3 rotation matrix R and the 3 translation (position) vector t of the camera. This means it contain 6 independent parameters (degrees of freedom), 3 for rotation and 3 for translation. K = ( R t ) The final perspective projective has 9 parameters and looks like this : X u ũ α 0 u 0 R R 2 R 3 t v = ṽ = 0 α v 0 R 2 R 22 R 23 t 2 Y Z w 0 0 R 3 R 32 R 33 t 2 2 EXERCISE 0 : HOMOGRAPHY Sometimes in sport event broadcasting the names of teams, players or advertisement images are projected on the field with the right perspective to fit the images from the camera. Create an OpenCV program that takes two images as input. One is a perspective photo of a sport field, a swimming pool or any other arena. The other is a flat image of some logo or advertisement. You can chose ny clicking any 4 points on the photo of the arena and the logo image should be transformed and overplayed over the original photo. Figure 2.: Homography in sport broadcasting 3 EXERCISE 02 : Create a 3D scene in OpenCV where a rectangular image is positioned so that its centre is in the origin of the 3D coordinate system. A camera is looking always in the direction of the image (the coordinate origin ) and gives an image of size 52 x 52 pixels and fix the focal length to a reasonable value (for example 00 pixels) to keep the image inside the view of 5

the camera. The position of the camera is described by spherical coordinates (figure 3.) and controller using three parameters that are input by the user using sliders on the main interface. Those are : r : the distance from the coordinates origin point. φ : the angle on the horizontal plane. θ : the angel with the vertical axis. Figure 3.: Spherical coordinate system Remember that the camera still needs to always be looking at the coordinate origin point. Apply the proper computation and display the image as seen by the camera. After that, apply an Affine transform on the image in the centre. The input is 3 parameters also controlled by the user using sliders (with reasonable range): α : main rotation angle. β : secondary rotation angle (related to the scaling). λ : scale factor (the other factor λ 2 = ) 4 SUBMISSION : Please send me the code for each exercise in a separate file with any additional images or header files needed on this email : hassan.abu_alhaija@tu-dresden.de Deadline : 28 November 204. 6