Chapter 18. Geometric Operations

Similar documents
Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Georeferencing & Spatial Adjustment

Vector Algebra Transformations. Lecture 4

Georeferencing & Spatial Adjustment 2/13/2018

Graphics and Interaction Transformation geometry and homogeneous coordinates

The Problem. Georeferencing & Spatial Adjustment. Nature Of The Problem: For Example: Georeferencing & Spatial Adjustment 9/20/2016

The Problem. Georeferencing & Spatial Adjustment. Nature of the problem: For Example: Georeferencing & Spatial Adjustment 2/4/2014

Announcements. Image Matching! Source & Destination Images. Image Transformation 2/ 3/ 16. Compare a big image to a small image

3D Geometry and Camera Calibration

N-Views (1) Homographies and Projection

x = 12 x = 12 1x = 16

x' = c 1 x + c 2 y + c 3 xy + c 4 y' = c 5 x + c 6 y + c 7 xy + c 8

Brightness and geometric transformations

CPSC 4040/6040 Computer Graphics Images. Joshua Levine

Image and Multidimensional Signal Processing

Graphics Pipeline 2D Geometric Transformations

Lecture 2.2 Cubic Splines

Transforms. COMP 575/770 Spring 2013

2D/3D Geometric Transformations and Scene Graphs

Geometric Transformations

Motion. 1 Introduction. 2 Optical Flow. Sohaib A Khan. 2.1 Brightness Constancy Equation

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

Visual Recognition: Image Formation

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Short on camera geometry and camera calibration

COMP 175 COMPUTER GRAPHICS. Ray Casting. COMP 175: Computer Graphics April 26, Erik Anderson 09 Ray Casting

CS4670: Computer Vision

Figure (5) Kohonen Self-Organized Map

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

An introduction to interpolation and splines

AH Matrices.notebook November 28, 2016

Geometric Correction

Digital Image Processing COSC 6380/4393

Introduction to Homogeneous coordinates

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

This week. CENG 732 Computer Animation. Warping an Object. Warping an Object. 2D Grid Deformation. Warping an Object.

EE795: Computer Vision and Intelligent Systems

9. Three Dimensional Object Representations

Perspective Mappings. Contents

Rectification and Distortion Correction

Camera Model and Calibration

2D and 3D Transformations AUI Course Denbigh Starkey

COMP 558 lecture 19 Nov. 17, 2010

Camera model and multiple view geometry

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

Computer Graphics. Texture Filtering & Sampling Theory. Hendrik Lensch. Computer Graphics WS07/08 Texturing

Animating Transformations

B.Stat / B.Math. Entrance Examination 2017

METR Robotics Tutorial 2 Week 2: Homogeneous Coordinates

Image warping , , Computational Photography Fall 2017, Lecture 10

CoE4TN3 Medical Image Processing

Matrix Inverse 2 ( 2) 1 = 2 1 2

Edge and local feature detection - 2. Importance of edge detection in computer vision

COMPARATIVE STUDY OF DIFFERENT APPROACHES FOR EFFICIENT RECTIFICATION UNDER GENERAL MOTION

Robot Mapping. Least Squares Approach to SLAM. Cyrill Stachniss

Graphbased. Kalman filter. Particle filter. Three Main SLAM Paradigms. Robot Mapping. Least Squares Approach to SLAM. Least Squares in General

Basics of Computational Geometry

Homework 5: Transformations in geometry

Review for Mastery Using Graphs and Tables to Solve Linear Systems

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm

Finite Math - J-term Homework. Section Inverse of a Square Matrix

AQA GCSE Maths - Higher Self-Assessment Checklist

Birkdale High School - Higher Scheme of Work

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Lecture 17: Recursive Ray Tracing. Where is the way where light dwelleth? Job 38:19

6B Quiz Review Learning Targets ,

Number/Computation. addend Any number being added. digit Any one of the ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9

Rotation and Interpolation

Linear Transformations

Raster model. Alexandre Gonçalves, DECivil, IST

Perspective Projection Describes Image Formation Berthold K.P. Horn

Chapter 7: Computation of the Camera Matrix P

Matrix Operations with Applications in Computer Graphics

Parameterization. Michael S. Floater. November 10, 2011

Laser sensors. Transmitter. Receiver. Basilio Bona ROBOTICA 03CFIOR

Lesson 20: Exploiting the Connection to Cartesian Coordinates

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

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

Stereo imaging ideal geometry

CS6670: Computer Vision

Blacksburg, VA July 24 th 30 th, 2010 Georeferencing images and scanned maps Page 1. Georeference

Model Based Perspective Inversion

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections.

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review.

absolute value- the absolute value of a number is the distance between that number and 0 on a number line. Absolute value is shown 7 = 7-16 = 16

GEOG 4110/5100 Advanced Remote Sensing Lecture 4

(Refer Slide Time: 00:02:24 min)

EE795: Computer Vision and Intelligent Systems

Answers to practice questions for Midterm 1

HOUGH TRANSFORM CS 6350 C V

CS1114 Assignment 5, Part 1

Euclidean Space. Definition 1 (Euclidean Space) A Euclidean space is a finite-dimensional vector space over the reals R, with an inner product,.

1 Affine and Projective Coordinate Notation

Additional mathematical results

Year 8 Set 2 : Unit 1 : Number 1

CS6015 / LARP ACK : Linear Algebra and Its Applications - Gilbert Strang

CSE328 Fundamentals of Computer Graphics

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

Transcription:

Chapter 18 Geometric Operations To this point, the image processing operations have computed the gray value (digital count) of the output image pixel based on the gray values of one or more input pixels; in other words, the operation changed the gray value to something new. Geometrical image processing operations are fundamentally different; instead of modifying the gray values of pixels, they redefine the pixel locations without changing their values (except to interpolate the values to the new pixel grid). In other words, geometrical operations change the spatial relationships between image pixels to correct distortions due to recording geometry, scale changes, rotations, perspective (keystoning), or due to curved or irregular object surfaces. In this section, we will define the procedures for specifying and implementing a range of geometrical operations. In theory, it is possible (though exhausting!) to describe geometric transformations via a lookup table of input/output coordinates, i.e., the table would specify new output coordinates [x 0,y 0 ] for each input location [x, y]. Equivalently, the coordinate lookup table could specify the input coordinates [x, y] that map to a specific output pixel [x 0,y 0 ]. For an N M image, suchalookuptablewouldcontainn M ordered pairs ( = 262, 144 pairs for a 449

450 CHAPTER 18 GEOMETRIC OPERATIONS 512 512 image). The lookup table can specify any arbitrary geometric transform, i.e., input pixels in the same neighborhood may move to locations that are very far apart in the output image. Besides using large blocks of computer memory, coordinate lookup tables are more general than usually necessary. In realistic applications, neighboring pixels in the input image will usually remain in close proximity in the output image, i.e., their coordinates will be transformed in similar manner. Such coordinate mappings are also called rubber-sheet transformations or image warping and may be specified by a set of parametric equations that specify the output coordinates for a given input position: x 0 = α [x, y] y 0 = β [x, y] = O{f [x, y]} = f [x 0,y 0 ]=f[α[x, y],β[x, y]]. The gray level f at the location [x, y] is transferred to the new coordinates [x 0,y 0 ] to create the output image f[x 0,y 0 ]. This sequence of operations equivalent to defining a new imageg [x, y] in the same coordinates [x, y] but with different gray levels; hence: g [x, y] =f [α [x, y],β[x, y]]. To preserve the arrangement of pixel gray values in neighborhoods, the transformation of the continuous coordinates should be continuous, i.e., the derivative must be finite everywhere. A power series of the input coordinates for positive powers satisfies this requirement: X X x 0 = a nm x n y m = a 00 + a 10 x + a 01 y + a 11 xy + a 20 x 2 + y 0 = n=0 m=0 X n=0 m=0 X b nm x n y m = b 00 + b 10 x + b 01 y + b 11 xy + b 20 x 2 + In practice, the infinite series is truncated, thus limiting the range of possible transformations. Under many conditions, only four terms are necessary in each expression, i.e., a nm and b nm =0for n, m 2: x 0 = a 00 + a 10 x + a 01 y + a 11 xy y 0 = b 00 + b 10 x + b 01 y + b 11 xy Such a transformation is called bilinear. There are eight unknown coefficients in the transformation, and thus eight independent equations are needed to find a solution. Knowledge of the coordinate transformation of the vertices of a quadrilateral is sufficient to find a solution for this transformation. In other words, knowledge of the

451 action on four locations [x 1,y 1 ] [x 0 1,y1] 0 [x 2,y 2 ] [x 0 2,y 2 ] [x 3,y 3 ] [x 0 3,y3] 0 [x 4,y 4 ] [x 0 4,y 4 ] will allow calculation of the eight coefficients. The problem may be cast in matrix notation where the known inputs [x i,y i ] and outputs x 0 i,y 0 i are arranged as column vectors in the matrices X and X 0, respectively, and the unknown coefficients a ij and b ij aretherowsofthematrixa in the expression: a 00 a 10 a 01 a 11 b 00 b 10 b 01 b 11 A X = X 0 1 1 1 1 x 1 x 2 x 3 x 4 = y 1 y 2 y 3 y 4 x 1 y 1 x 2 y 2 x 3 y 3 x 4 y 4 x0 1 x 0 2 x 0 3 x 0 4 y1 0 y2 0 y3 0 y4 0 If X is square (and if no three of the known points lie on the same straight line), then the inverse matrix X 1 exists; the coefficients a ij and b ij may be found via a straightforward calculation: (A X ) X 1 = X 0 X 1 = A = X 0 X 1 The four known vertices in the input and output images are sometimes called control points. More control points may be used in a bilinear fit, thus making the problem overdetermined (more equations than unknowns). A unique solution of an overdetermined problem may not exist if there is uncertainty ( noise ) in the data. Under such conditions, either a least-squares solution is generated or the control points are applied locally to find local transformations for different sections of the image. If the distortion cannot be adequately represented by a power series with eight coefficents, then more than four control points are required.

452 CHAPTER 18 GEOMETRIC OPERATIONS 18.1 Least-Squares Solution for Warping The procedure for computing the least-squares solution for the coefficients of a geometric transformation is quite easy in matrix notation. For example, consider a the geometric transformation which adds a constant coordinate translation and magnifications in the orthogonal directions. The coordinate equations are: x 0 = a 00 + a 10 x + a 01 y y 0 = b 00 + b 10 x + b 01 y where the coefficients a ij and b ij must be calculated. The system of equations has six unknown quantities and so requires six equations to obtain a solution. Since each control point (input-output coordinate pair) yields equations for both xand y, three control points are needed. If more control points (say five) are available and consistent, the extras may be ignored and the the matrix inverse computed as before. If the positions of the control points are uncertain, the equations will be inconsistent and the matrix inverse will not exist. Under these conditions, the additional control points will improve the estimate of the transformation. The computation of the coefficients which minimizes the squared error in the transformation is called the least-squares solution, and is easily computed using matrix algebra as a pseudoinverse. If we have five known control point pairs, the matrix transformation is composed of the 2 row by 3 column matrix A, the 3 row by 5 column matrix X and the 2 row by 5 column matrix X 0 : a 00 a 10 a 01 b 00 b 10 b 01 A X = X 0 1 1 1 1 1 x 1 x 2 x 3 x 4 x 5 = y 1 y 2 y 3 y 4 y 5 x0 1 x 0 2 x 0 3 x 0 4 x 0 5 y1 0 y2 0 y3 0 y4 0 y5 0 If X were square (and invertible), we would compute X 1 to find A via: A = X 0 X 1 However, X isnotsquareinthiscase,andthusitsinversex 1 does not exist. We may evaluate a pseudoinverse of X that implements a least-squares solution for A via the following steps for the the general case where X has p rows and q columns (p =3and q =5in the example above). 1. multiply both sides of the equation from the right by the transpose matrix X T, which is obtained from X byexchangingtherowsandcolumnstoobtaina matrix with q rows and p columns. The result is: (A X) X T = X 0 X T

18.1 LEAST-SQUARES SOLUTION FOR WARPING 453 2. The associativity of vector multiplication allows the second and third matrices on the left-hand side to be multiplied first: (A X) X T = A X X T 3. ThematrixX X T is p p square. In the example above, the product of the two matrices is 3 3 square: 1 x 1 y 1 1 1 1 1 1 1 x 2 y 2 X X T = x 1 x 2 x 3 x 4 x 5 1 x 3 y 3 y 1 y 2 y 3 y 4 y 5 1 x 4 y 4 1 x 5 y 5 5 x 1 + x 2 + x 3 + x 4 + x 5 y 1 + y 2 + y 3 + y 4 + y 5 = x 1 + x 2 + x 3 + x 4 + x 5 x 2 1 + x 2 2 + x 2 3 + x 2 4 + x 2 5 x 1 y 1 + x 2 y 2 + x 3 y 3 + x 4 y 4 + x 5 y 5 y 1 + y 2 + y 3 + y 4 + y 5 x 1 y 1 + x 2 y 2 + x 3 y 3 + x 4 y 4 + x 5 y 5 y1 2 + y2 2 + y3 2 + y4 2 + y5 2 Since X X T is square, there is some chance that its inverse X X T 1 exists. If so, then we can multiply the left-hand side from the right by this inverse; the result is the desired matrix of coefficients A: A X X T X X T 1 = A 4. If we perform the same series of steps on the right-hand side, we obtain the desired formula: A = X 0 X T X X T 1 = X 0 ³X T X X 1 T

454 CHAPTER 18 GEOMETRIC OPERATIONS a 00 a 10 a 01 a 11 b 00 b 10 b 01 b 11 = x0 1 x 0 2 x 0 3 x 0 4 x 0 5 y1 0 y2 0 y3 0 y4 0 y5 0 1 x 1 y 1 x 1 y 1 1 x 1 1 1 1 1 1 y 1 x 1 y 1 1 x 2 y 2 x 2 y 2 1 x x 1 x 3 y 3 x 3 y 3 1 x 2 x 3 x 4 x 5 2 y 2 x 2 y 2 1 x y 1 x 4 y 4 x 4 y 4 1 y 2 y 3 y 4 y 5 3 y 3 x 3 y 3 1 x x 1 y 1 x 2 y 2 x 3 y 3 x 4 y 4 x 5 y 5 4 y 4 x 4 y 4 1 x 5 y 5 x 5 y 5 1 x 5 y 5 x 5 y 5 1 18.2 Common Geometrical Operations x 0 = x, y 0 = y = g [x, y] =f[x 0,y 0 ]=f[x, y] = identity transformation, no change x 0 = x + x 0, y 0 = y + y 0 = g [x, y] =f[x + a 00,y+ b 00 ] = translation by [a 00,b 00 ] x 0 = ax, y 0 = by = g [x, y] =f[a 10 x, b 01 y] = spatial stretching or scaling x 0 = x + ay, y 0 = y = g [x, y] =f[x + a 01 y, y] = skew x 0 = x + axy, y 0 = y = g [x, y] =f[x + a 11 xy, y] = perspective distortion x 0 = α [x, y] =x cos θ y sin θ = rotation thru θ y 0 = β [x, y] =x sin θ + y cos θ [x 0,y 0 ] are the coordinates of the input image that are mapped to [x, y] in the output image.

18.3 PIXEL TRANSFERS 455 18.3 Pixel Transfers As already mentioned, a geometrical transformation may be implemented by specifying the where each pixel of the input image is located in the output grid, or by specifying the location of each output pixel on the input grid. Except for certain (and usually uninteresting) transformations, pixels of the input image will rarely map exactly to pixels of the output grid. It is therefore necessary to interpolate the gray value from pixels with noninteger coordinates (i.e., nongrid points) to pixels with integer coordinates that lie upon the grid. The method that transfers the input pixel coordinates and interpolates the gray value on the output grid is called pixel carryover by Castleman. It may also be called an input-to-output mapping. The algorithm that locates the output pixel upon the input grid and interpolates the gray value of the input pixels is called pixel filling or an output-to-input mapping.

456 CHAPTER 18 GEOMETRIC OPERATIONS 18.4 Pixel Interpolation Gray-value interpolation is based on the relative distances of the nearest neighbors to or from the geometrically transformed pixel. In the simplest case (nearest-neighbor or zeroth-order interpolation), all of the gray value is transferred to or from the nearest pixel. However, since the distances of the four neighbors must be evaluated to determine which is closest, it generally is quite easy to upgrade nearest-neighbor calculations to bilinear interpolation. This method divides the gray level of the noninteger pixel among its four nearest integer neighbors in inverse proportion to the distance; if the transferred pixel is equidistant from the four neighbors, then its gray value is divided equally, if it is much closer to one of the four grid points, most of its gray value is transferred to that pixel. For pixel filling, the gray value at the output pixel g [x 0,y 0 ] is determined from the following equation, where x n,y n are the coordinates of the nearest pixel of the input grid to the transformed pixel, and d n are the respective distances: g [x 0,y 0 ]= 1 d 1 f 1 [x 1,y 1 ]+ 1 d 2 f 2 [x 2,y 2 ]+ 1 d 3 f 3 [x 3,y 3 ]+ 1 d 4 f 4 [x 4,y 4 ] 1 d 1 + 1 d 2 + 1 d 3 + 1 d 4 Schematic of interpolation of pixel gray value. The input and output grids of pixels are shown as solid and dashed lines, respectively. The distances of the output pixel from the four nearest neighbors are labeled d 1 d 4. The gray level of the transformed pixel can be divided among more of the neighboring pixels by using higher-order interpolation, e.g., cubic spline, etc.

18.4 PIXEL INTERPOLATION 457 18.4.1 Example: Image Rotation The examples are small (64 64) images rotated by the degree increments specified. The images have been interpolated using the output-to-input mapping and bilinear interpolation. Note that artifacts are visible, particularly at 45.