Computer vision
Cameras
Le Thanh Ha, Ph.D
Assoc. Prof. at University of Engineering and Technology,
Vietnam National University
ltha@vnu.edu.vn; lthavnu@gmail.com; 0983 692 592
Cameras
• First photograph due to Niepce
• First on record shown in the book - 1822
• Basic abstraction is the pinhole camera
– lenses required to ensure image is not too dark
– various other abstractions can be applied
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Pinhole cameras
• Abstract camera model - box with a • Pinhole cameras work in practice
small hole in it
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Distant objects are smaller
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Parallel lines meet
Common to draw film plane
in front of the focal point.
Moving the film plane merely
scales the image.
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Vanishing points
• each set of parallel lines (=direction) • Good ways to spot faked images
meets at a different point – scale and perspective don’t work
– The vanishing point for this direction – vanishing points behave badly
• Sets of parallel lines on the same plane – supermarket tabloids are a great source.
lead to collinear vanishing points.
– The line is called the horizon for that plane
The equation of projection
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
The equation of projection
• Cartesian coordinates:
– We have, by similar triangles, that
(x, y, z) -> (f x/z, f y/z, -f)
– Ignore the third coordinate, and get
(𝑥’, 𝑦’)
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Homogenous coordinates
• Add an extra coordinate and use an • Basic notion
equivalence relation – Possible to represent points “at infinity”
• for 2D • Where parallel lines intersect
• Where parallel planes intersect
– equivalence relation
k*(X,Y,Z) is the same as (X,Y,Z) – Possible to write the action of a
perspective camera as a matrix
• for 3D
– equivalence relation
k*(X,Y,Z,T) is the same as (X,Y,Z,T)
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
The camera matrix
• Turn previous expression into Homogenous
coordinate (HC)’s
– HC’s for 3D point are (X,Y,Z,T)
– HC’s for point in image are (U,V,W)
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Orthographic projection
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
The projection matrix for orthographic projection
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Pinhole too big -
many directions are
averaged, blurring the
image
Pinhole too small-
diffraction effects blur
the image
Generally, pinhole
cameras are dark, because
a very small set of rays
from a particular point
hits the screen.
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
The reason for lenses
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
The thin lens
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Spherical aberration
Spherical aberration: The gray region is the paraxial zone where the
rays issued from P intersect at its paraxial image p. If an image plane π
were erected in p, the image of p in that plane would form a circle of
confusion of diameter e. The focus plane yielding the circle of least
confusion is indicated by a dashed line.
Distortion: From left to right, the nominal image of a fronto-parallel
square, pincushion distortion, and barrel distortion.
Chromatic aberration: The index of refraction of a transparent medium
depends on the wavelength (or color) of the incident light rays. Here, a
prism decomposes white light into a palette of colors. Figure from US
NAVY MANUAL OF BASIC OPTICS AND OPTICAL INSTRUMENTS, prepared
by the Bureau of Naval Perso```nnel, reprinted by Dover Publications,
Inc. (1969).
2/27/2023 Le Thanh Ha, Lab of HMI 17
Vignetting
Vignetting effect in a two-lens system. The shaded part of
the beam never reaches the second lens. Additional
apertures and stops in a lens further contribute to
vignetting.
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Other (possibly annoying) phenomena
• Chromatic aberration
– Light at different wavelengths follows different paths; hence, some wavelengths are defocussed
– Machines: coat the lens
– Humans: live with it
• Scattering at the lens surface
– Some light entering the lens system is reflected off each surface it encounters (Fresnel’s law gives
details)
– Machines: coat the lens, interior
– Humans: live with it (various scattering phenomena are visible in the human eye)
• Geometric phenomena (Barrel distortion, etc.)
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
INTRINSIC AND EXTRINSIC PARAMETERS
• The world and camera coordinate systems are related by a set
of physical parameters: focal lens, the size of the pixels, the
position of the image center, and the position and orientation
of the camera.
• Intrinsic parameters, which relate the camera’s coordinate
system to the idealized coordinate system.
• Extrinsic parameters, which relate the camera’s coordinate
system to a fixed world coordinate system and specify its
position and orientation in space.
2/27/2023 Le Thanh Ha, Lab of HMI 20
Intrinsic parameters
Scale scale+translation scale+rotation+translation
Intrinsic matrix 21
Extrinsic parameters
Transformation from world coor. to image plane coor.
Extrinsic matric
2/27/2023 Le Thanh Ha, Lab of HMI 22
Camera parameters
• There are 16 unknowns in intrinsic and extrinsic matrices
• Non-linear
• Estimating these parameters from experiments called camera calibration
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Camera calibration
• Issues: • Error minimization:
– what are intrinsic parameters of the – Linear least squares
camera? • easy problem numerically
– what is the camera matrix? • solution can be rather bad
(intrinsic+extrinsic) – Minimize image distance
• General strategy: • more difficult numerical problem
– view calibration object • solution usually rather good,
– identify image points • start with linear least squares
– obtain camera matrix by minimizing error – Numerical scaling is an issue
– obtain intrinsic parameters from camera
matrix
Computer Vision - A Modern Approach
Set: Cameras
Slides by D.A. Forsyth
Camera calibration
Camera calibration setup:
In this example, the
calibration rig is formed
by three grids drawn in
orthogonal planes. Other
patterns could be used as
well, and they may
involve lines or other
geometric figures.
2/27/2023 Le Thanh Ha, Lab of HMI 25
Camera calibration
2/27/2023 Le Thanh Ha, Lab of HMI 26
Camera calibration
• Bài tập:
– In bảng chess board dành cho camera calibration.
– Dán bảng chess board lên mặt phẳng sàn nhà và sử dụng bảng này để xác
định hệ tọa độ thực của căn nhà (world coordinate)
– Sử dụng camera điện thoại để chụp chess board ở nhiều góc và kích thước
khac nhau
– Viết chương trình camera calibration sử dụng tài liệu tham khảo phía dưới
• Do exercise camera calibration with OpenCV
• https://docs.opencv.org/2.4/doc/tutorials/calib3d/camera_calibrati
on/camera_calibration.html
2/27/2023 Le Thanh Ha, Lab of HMI 27