0% found this document useful (0 votes)
37 views

Geometric Primitives and Transformations

This document discusses geometric primitives and transformations that are important concepts in computer vision. It covers points, lines, and conics represented in 2D projective space using homogeneous coordinates. It also describes various 2D transformations like translation, rotation, similarity and affine transformations. It explains how spatial transformations can warp images and discusses forward and inverse warping approaches. It covers nearest-neighbor and bilinear interpolation techniques used for inverse warping.

Uploaded by

saranraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Geometric Primitives and Transformations

This document discusses geometric primitives and transformations that are important concepts in computer vision. It covers points, lines, and conics represented in 2D projective space using homogeneous coordinates. It also describes various 2D transformations like translation, rotation, similarity and affine transformations. It explains how spatial transformations can warp images and discusses forward and inverse warping approaches. It covers nearest-neighbor and bilinear interpolation techniques used for inverse warping.

Uploaded by

saranraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Computer Vision

Geometric primitives and


transformations

Filippo Bergamasco ([email protected])


http://www.dais.unive.it/~bergamasco
DAIS, Ca’ Foscari University of Venice
Academic year 2017/2018
Geometric primitives

Geometric primitives form the basic building blocks used


to describe 2D and 3D shapes.

We will study the basic geometric primitives (points,


lines, conics) and the transformations that can be
defined between them

The framework of projective geometry allow us to


describe such transformations in a powerful generic
way.
Points

Points lying on an Euclidean 2D plane (like the image


plane) are usually described as vectors:

This is a common way to reason about points but has


some limitations. For example, we cannot describe
points at infinity…
...Other alternatives are possible!
2D Projective space

Since the imaging apparatus usually behaves like a


pinhole camera model, many of the transformations
that may happen can be described as projective
transformations.
> This offer a general and powerful way to work
with points, lines and conics

The 2D projective space is simply defined as:


Homogeneous coordinates
A point in a 2D Euclidean plane can be described in
homogeneous coordinates (2D projective space) as
follows:

This implies that:


• There are infinitely many ways to describe a point x
• points in euclidean space are represented by all the
equivalence classes of three dimensional vectors
where two elements are in the same class if they
differ by a non zero scale factor.
Homogeneous coordinates

From Euclidean to homogeneous:


Just add 1 to the last component

From homogeneous to Euclidean:


Divide by the last component (if not zero)
Homogeneous coordinates

All the points

are called ideal points or points at infinity and do


not have an equivalent inhomogeneous representation
(in Euclidean plane).
2D Lines

A line in the Euclidean plane can be described as the


locus of points p=(x,y) so that:

In projective space, the same line can be


represented as:
2D Lines

This represent each


This represent the line
point on the line
itself

in P2 points and lines are described in the same way!


This leads to a simple expression to find the
intersection x of two lines u and u’ using the cross
product:
2D Lines intersection

What happens if the lines are parallel?


Line and points

Similarly, the line l joining two points p1 and p2


can be expressed as:
2D Lines

We can normalize a line

So that
2D Lines

With a normalized line,


• The vector (n1 n2)T is the line normal and d is the
line distance to the origin

• The point-line distance d from a line l and a point x


can be computed as
Conics

Conics that can be represented by second degree


polynomials in the form ax2+bxy+cy2+dx+ey+f =0

In homogeneous coordinates the conic can be


represented by a matrix

Such that, for each point x=(x y 1)T, it holds that


Conics
Depending on the parameters, we can obtain different
conics:
• Circles
• Ellipses
• Parabolae
• Hyperbolae

Any projectivity transforming the projective space P2 in which


the conic lie will result in a (possible different) type of conic.

Ellipses present in a scene are interesting geometric primitives


since they remain ellipses after being projected into the image
plane.
2D projectivities

A planar projective transformation is a linear


transformation in P2 that can be represented by any
non-singular 3x3 matrix H:

Any projective transformation transform lines in


lines and preserve the incidence.
2D Translation

Dof: 2
Preserves: Orientation
2D Rotation

Dof: 1
Preserves: Lengths
2D Rigid motion

Combination of a rotation R and a translation T


Dof: 3
Preserves: Lengths
2D Similarity

Where s is a non-zero scale factor.


Rotation+Scale+Transl.
Dof: 4
Preserves: Angles between lines
2D Affine transformation

Dof: 6
Preserves: Parallellism of lines
2D Projective transformation

Projective transformation is also called homography.


Since we work in P2, H is defined up to scale
Dof: 8 (not 9! Because any scale define the same
transformation)
Preserves: Straight lines
Transformations table
Spatial transformations

The projective transformations discussed so far can


be applied to the image domain to transform the
geometry of the image plane

Given an image
And a transformation function
A spatial transformation changes the image as
following:

NOTE: Different from intensity transformations:


Spatial transformations

Example: image rotation


Forward warp

How to perform the transformation? One simple way


is via forward warping:

A pixel f(x) is copied to its corresponding location


x’=s(x) in image g(x’).
Forward warp

Problem: x’ usually has a non-integer value, and


g(x’) is not defined in that case

Possible solution1:
Round the value and copy the pixel there (Create
cracks and holes)

Possible solution2:
Distribute the value among its n-neighbours in a
weighted fashion (Cause aliasing and blur)
Forward warp
Inverse warp

A preferable solution is to use inverse warping:

each pixel in the destination image g(x’) is sampled


from the original image at x = s-1(x’)
Inverse warp

Advantages:
• No holes since s-1(x’) is defined for all values of x’
(in all the g(x’) domain)

Problems:
• The transformation function must be invertible (not
really a problem since our transformation matrix is
non-singular)
• Point sampling may still occur at non integer
locations
– This is a well studied problem: Image interpolation
Nearest-neighbour
interpolation
Interpolation: estimate the values using the
information from nearby samples

Nearest-neighbour:
Use the image value at the closest integer location
Nearest-neighbour
interpolation
NN-interpolation is very fast but creates artefacts
(blocks) especially if the transformation changes the
scale (ie.zooming)
Bilinear interpolation

Use the four points around s-1(x’) to get a better


estimation:
Bilinear interpolation
Bilinear interpolation

Bilinear
NN-interpolation
interpolation

You might also like