0% found this document useful (0 votes)
14 views27 pages

Computer Vision Planar Scenes and Homography

The document discusses planar scenes in computer vision, emphasizing their significance in applications like augmented reality, object tracking, and image stabilization. It introduces homography as a transformation that relates two images of the same planar scene and outlines techniques for plane detection, including RANSAC and Hough Transform. Practical applications in fields such as autonomous vehicles, architecture, and image processing are also highlighted.

Uploaded by

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

Computer Vision Planar Scenes and Homography

The document discusses planar scenes in computer vision, emphasizing their significance in applications like augmented reality, object tracking, and image stabilization. It introduces homography as a transformation that relates two images of the same planar scene and outlines techniques for plane detection, including RANSAC and Hough Transform. Practical applications in fields such as autonomous vehicles, architecture, and image processing are also highlighted.

Uploaded by

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

Planar Scenes and

Homography
Planar Scenes
• Planar scenes in computer vision refer to the analysis
of scenes where the objects or features of interest lie on
a flat plane.
• This is particularly useful in applications like augmented
reality, object tracking, and image stabilization
•The above figure is a special
case of the two-view
configuration of points on a
plane:
•X2 = RX1 + T
•In this case, the vector
normal from camera 1 is a
perpendicular distance d from
the plane P:
•NTX1 = n1X + n2Y + n3Z = d
•or,
• The concepts of planar scenes are applied in so many
fields. In computer vision the following are noted:
• Scene Reconstruction: Reconstructing a 3D scene
from 2D images often involves approximating parts of
the scene as planar surfaces.
• Feature Detection: Algorithms like edge detection and
corner detection can be simplified in planar scenes.
• Augmented Reality (AR): Many AR applications rely
on detecting flat surfaces (e.g., tables, walls) to place
virtual objects.
Techniques/Methods in Planar
Scenes
1. Homography:
• A homography is a transformation that maps points from one plane
to another. It’s used to relate two images of the same planar scene.
• Application: Used in image stitching, rectification, and perspective
correction.
2. Plane Detection Algorithms:
• RANSAC (Random Sample Consensus): Commonly used to
detect planes in a set of 3D points by fitting a model and iteratively
refining it.
• Hough Transform: Used for detecting lines and planes by
transforming the points to a parameter space and finding
accumulations.
Techniques/Methods in Planar Scenes

Depth Sensors and LIDAR:


Usage: Devices like LIDAR and depth sensors can
detect planar surfaces by measuring distances
accurately.
Applications: Used in autonomous vehicles and
robots for environment mapping and navigation.

Lidar, which
stands for Light
Detection and
Ranging, is a
remote sensing
method that uses
light in the form
of a pulsed laser
to measure
ranges (variable
Examples and Practical
Applications
1.Autonomous Vehicles:
• Planar scene detection helps in identifying roads, sidewalks,
and other flat surfaces crucial for navigation and path
planning.
2.AR Applications:
• Placing virtual objects realistically in the real world often
requires identifying and using planar surfaces as reference
points.
3.Architecture and Interior Design:
• Creating accurate 3D models of interiors often involves
detecting and modeling walls, floors, and ceilings as planar
surfaces.
Homograp
hy
• Homography is a vital concept in image analysis, enabling us to
map the perspective of a scene onto a different plane or view. By
applying homography transformations, we can rectify distortions,
align images, and even overlay virtual objects seamlessly. This
technique plays a crucial role in enhancing visual content and
extracting valuable information from images.
Homography
• Homography is a concept in computer vision that refers
to the relationship between two images of the same
planar surface under different perspectives.
• It’s a transformation that can be represented by a 3x3
matrix, which allows for the mapping of points from one
image plane to another while preserving straight lines.
Homography
Linear Mappings
• linear mappings from one particular space to the other,
also called transformations
• Different types of transformations from a 2d image to
another 2d images
• Translation, rigid, similarity, affine, projective
• Next one in the list includes all the previous members
• i.e. Perspective transformation is a superset of all previous
• A 2d perspective transformation is commonly called an
image warp or a homography
• Warp takes a 2d image and produces another 2d image
• Maps from a pixel in source image to a pixel destination

• Consider,
• Let us consider a 3D
coordinate frame and two
arbitrary planes as shown
below:
• The first plane is defined by the point and two
linearly independent vectors contained in the
plane.
• Let is consider a point in this plane. Since the
vectors and form a basis in this plane, we can
express as

Where

• defines the plane.


• defines the 2D coordinates of with respect to the
basis
Definitions
• We can write a similar identity for the second plane
• Where defines the plane
• defines the 2D coordinates of with respect to the basis
• We now impose the constraints that point maps to point
under perspective centered at the origin:

• Where:
• is a scalar that depends on , and consequently on
(since the plane is fixed)
• By combining the equation above with the constraint that
each of the two points must be situated in its corresponding
plane, one obtains the relationship between the 2D
coordinates of these points:

• Note that the matrix A is invertible because are linearly


independent and nonzero (the two planes do not pass
through origin).
• Also note that the two vectors and above have a unit third
coordinate.
• Hence the role of is simply to scale the term such that its
third coordinate is 1
• We can get rid of this nonlinearity by moving to
homogeneous coordinates:

• Where,
• are homogeneous 3D vectors
• H ∈ ℜ3X3 is called a homography matrix and has 8 degrees
of freedom, because it is defined up to a scaling factor (H =
cA−1B where c is any arbitrary scalar)
• The mapping defined by (1) is called a 2D homography.
Applications of Homographies
• Mosaics (image processing)
• Involves computing homographies between pairs of input
images
• Employs image-image mappings

• Removing perspective distortion


• Requires computing homographies between an image and
scene surfaces
• Employs image-scene mappings
• Rendering textures (computer graphics)
• Requires applying homographies between a planar scene surface and the
image plane, having the camera as the center of projection.
• Employs scene-image mappings

• Computing planar shadows (computer graphics)


• Requires applying homographies between two surfaces inside a 3D scene,
having the light source as the center of projection
• Employs scene-scene mappings
Implementation
• import numpy as np
• import matplotlib.pyplot as plt

• from skimage import transform


• from skimage.io import imread, imshow
• import cv2
• monopoly = imread('homopicture.jpg')
• imshow(monopoly)
<matplotlib.image.AxesImage at 0x134763da290>
• # Convert the image from BGR to • # Plot the image
RGB for proper visualization with • plt.imshow(monopoly)
Matplotlib
• monopoly = cv2.cvtColor(monopoly,
cv2.COLOR_BGR2RGB) • # Plot the points on the image with
red color
• plt.scatter(src[:, 0], src[:, 1],
• # Define the source points
color='red', marker='o')
• src = np.array([170, 90,
• 1560, 1080, • # Show the image with the plotted
• 0, 1100, points
• 1360, 70, • plt.show()
• ]).reshape((4, 2))
• dst = np.array([0, 100,
• 1500, 1000,
• 0, 1000,
• 1500, 100,
• ]).reshape((4, 2))
• tform = transform.estimate_transform('projective', src,
dst)
• tf_img = transform.warp(monopoly, tform.inverse)
• fig, ax = plt.subplots()
• ax.imshow(tf_img)
• _ = ax.set_title('projective transformation')

You might also like