Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Computer Vision
Version vom 11.05.2015
1-1
Content
Computer Vision
Version vom 11.05.2015
1-2
Computer Vision
Version vom 11.05.2015
1-3
Focal length f
Principle Plane
Sensor Plane/Image Plane
Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf Hirtz
Computer Vision
Version vom 11.05.2015
1-4
Computer Vision
Version vom 11.05.2015
1-5
Computer Vision
Version vom 11.05.2015
1-6
X wrld
xwrld
y
wrld
zwrld
w
wrld
Ximg
ximg
yimg
wimg
3D scene point
Camera
zwrld
Ximg
X wrld
ywrld
xwrld
Observed scene
2D
Image point
Image
Computer Vision
Version vom 11.05.2015
1-7
X wrld
xwrld
y
wrld
zwrld
w
wrld
Extrinsic model
Xcam
Xcam
xcam
y
cam
zcam
w
cam
Intrinsic model
Ximg
ximg
yimg
wimg
xcam
zcam
ximg
Image coordinate system
Camera
zwrld
ycam
X wrld
xwrld
yimg
ywrld
Ximg
Observed scene
Computer Vision
Version vom 11.05.2015
1-8
R 0 C0
Camera
Xcam,0
Xcam,1
xcam
zcam
R1 C1
Camera
zwrld
X wrld
xwrld
Observed scene
ywrld
H1
H0
R
Hi i
0
R iCi
1
Xcam,0 H 0 1 X wrld
Xcam,1 H11 X wrld
Ci
origin of the camera coordinate
frame provided in world frame
coordinates
Ri
3x3 rotation matrix representing the
orientation of the
camera
coordinate frame with respect to
the world frame
R results out of three angles
discribing a sequence of three
elementary rotations around x, y, zaxis respectively (each performed
clockwise)
Computer Vision
Version vom 11.05.2015
1-9
Camera 3
WCS
Camera 2
Camera 1
Computer Vision
Version vom 11.05.2015
1-10
0006 C2 = [-1.6157;
-0.7770
0.6286
0.0339
0011
0.3719
0.5018
-0.7809
0012
-0.5079
-0.5942
0014 R2 = [
-0.5233
-0.8521
0.0080
0015
-0.5388
0.3236
-0.7778
0016
0.6602
-0.4113
0018 R3 = [
-0.4861
-0.8670
0.1097
0019
-0.6689
0.2884
-0.6852
0020
0.5624
-0.4065
-0.6237];
0013
-0.6285];
0017
-0.7201];
0021
Computer Vision
Version vom 11.05.2015
1-11
0036
0037 i = [1; 0; 0];
0038 j = [0; 1; 0];
0039 k = [0; 0; 1];
0040 o = [0; 0; 0];
0041
0042 plot3([o(1) i(1)], [o(2) i(2)], [o(3) i(3)], 'r-', 'MarkerSize', 5);
0043 plot3([o(1) j(1)], [o(2) j(2)], [o(3) j(3)], 'g-', 'MarkerSize', 5);
0044 plot3([o(1) k(1)], [o(2) k(2)], [o(3) k(3)], 'b-', 'MarkerSize', 5);
Professur Digital- und Schaltungstechnik
Prof. Dr.-Ing. Gangolf Hirtz
Computer Vision
Version vom 11.05.2015
1-12
Computer Vision
Version vom 11.05.2015
1-13
H0
H1
WCS
H2
0064
Floor (z == 0 m)
Computer Vision
Version vom 11.05.2015
1-14
Xcam
xcam
y
cam
zcam
w
cam
Projection
X norm
xnorm
ynorm
1
ynorm
Xnorm
xnorm
Normalized sensor coordinate system
Xcam
Observed scene
zcam
xcam
Camera centre/Principle point
Computer Vision
Version vom 11.05.2015
1-15
Xcam
xcam
ycam
zcam
x
X norm norm F ( ) ( ) u r
ynorm
cos
with u r
sin
elevation
ynorm
Xnorm ()
ur
xnorm
distance
Xcam
Observed scene
azimuth
ycam
zcam
xcam
Computer Vision
Version vom 11.05.2015
1-16
Function F
Perspective
projection
= tan
Applied
in
conventional
cameras that follow the pinhole
principle with < 2
Stereographic
projection
= 2 tan 2
Commonly
used
for
the
generation of stellar maps and
photography.
angles
are
preserved (equal angles) and
circles are imaged without
distortions (equal circles).
Equidistance
projection
Equisolid
angle
projection
= 2 sin
Orthogonal
projection
= sin
Computer Vision
Version vom 11.05.2015
1-17
Equiangular Projection
Applied by e.g. fish-eye cameras
FOV > 180
= tan
Computer Vision
Version vom 11.05.2015
1-18
X norm
xnorm
ynorm
1
Affine
Transformation
Ximg
ximg
yimg
wimg
ynorm
Xnorm
xnorm
ximg
Ximg
Ximg K X norm
Computer Vision
Version vom 11.05.2015
1-19
Computer Vision
Version vom 11.05.2015
1-20
imaging process
, yimg
img
Xcam
yimg z f ycam
cam
1
zcam
0
0
1 0
xcam
1 ycam
zcam zcam
1
normalized sensor coordinates
tan
image point in 2D
image frame
Ximg
Ximg P Xcam
P can be decomposed in the following manner:
object point in
3D world frame
Xcam
x
f ycam / zcam
f
P diag( f , f ,1) I | 0
zcam
Computer Vision
Version vom 11.05.2015
1-21
%% Camera Matrix
% Intrinsic Camera Parameter
f = 4;
% Focal Length
% Setup Projection matrix
P = diag([f f 1])*[eye(3) zeros(3, 1)];
%% Project World Point
Xw = [4; 5; 9];
% Object Point (World Frame)
% X = 4, Y = 5, Z = 9
Xw_h = [Xw; 1];
% Transform to homogeneous Coordinates
Xc_h = P*Xw_h;
% Project!
Xc = 1/Xw(3)*Xc_h;% Image Point (Camera Frame)
%% Plot Principal Point
figure_01 = figure; hold on; grid on;
plot3(0, 0, 0, 'm.', 'Markersize', 20);
%% Draw Image Plane
[X, Y, Z] = meshgrid(-5:0.1:5, -5:0.1:5, -5:0.1:5);
data = 0*X+0*Y+1*Z-f; % Normal from for a plane
p = patch(isosurface(X, Y, Z, data, 0)); hold on;
set(p, 'FaceColor', 'red', 'EdgeColor', 'none')
alpha(0.5); view(17,24);
axis([-5 5 -5 5 0 10]);
Computer Vision
Version vom 11.05.2015
1-22
Computer Vision
Version vom 11.05.2015
1-23
ximg ximg cx
yimg yimg c y
The principal point (cx, cy) is the offset with respect to the
image frame and enhances the camera calibration matrix
f
K
Ximg
ximg
Principal Point (cx, cy)
yimg
cx
c y
1
Computer Vision
Version vom 11.05.2015
1-24
Xcam R X wrld C
H1
H2
WCS
Homogeneous coordinates let us use this relation in a
more compact matrix form
R RC
Xcam
X wrld
1
with P KR I | C
Ximg K R |
RC X wrld
Translation vector T
Ximg K R I | C X wrld
Computer Vision
Version vom 11.05.2015
1-25
%% Camera Matrix
% Intrinsic Camera Parameter
f = 2;
% Focal Length
K = diag([f f 1]); % Intrinsic camera Parameter
% Extrinsic Camera Parameter
C1 = [-3; +4; -3];
% Camera Centre Cam 1
C2 = [3; -4; 1];
% Camera Centre Cam 2
C3 = [3; -5; -5];
% Camera Centre Cam 2
% Rotate Cam 1 by 0, Cam2
% arround the x-axis
R1 = [1.0000
0
0
1.0000
0
0
R2 = [1.0000
0
0
-0.7071
0
0.7071
R3 = [1.0000
0
0
0
0
1.0000
t1 = -R1*C1;
t2 = -R2*C2;
t3 = -R3*C3;
by 45 and Cam3 by 90
0
0
1.0000];
0
0.7071
0.7071];
0
1.0000
0];
Computer Vision
Version vom 11.05.2015
1-26
Computer Vision
Version vom 11.05.2015
1-27
Computer Vision
Version vom 11.05.2015
1-28
yimg
Ximg
x s
K
y
cx
c y with x f mx , y f m y , s f
1
s=0
Aspect Ratio
x/y = =1
1-29
Ximg P X wrld
x1 p11
x2 p21
x p
3 31
p12
p22
p32
p13
p23
p33
x
p14 1
x
p24 2
x
p34 3
x4
p1R
P p 2R
p 3R
|
p1C
|
p 2C
p 3C
|
p 4C
|
Computer Vision
Version vom 11.05.2015
1-30
Columns
Columns of P denote special points within the projection
plane
p1C, p2C, p3C are the projections of the axis directions of
x-, y- and z-axis.
p4C is the projection of the origin of the world frame.
Projection Centre/Principal Point
P C 0
Computer Vision
Version vom 11.05.2015
1-31
%% Camera Matrix
% Intrinsic Camera Parameter
f = 2;
% Focal Length
K = diag([f f 1]); % Intrinsic camera Parameter
K(1, 3) = 0;
K(2, 3) = 0;
% Extrinsic Camera Parameter
C = [0; 0; 0];
% Camera Centre
R = [1 0 0
0 0 1
0 1 0];
% We change x and y coordinates
t = -R*C;
% Translation vector with respect to R and C
% Setup Projection matrix
P = K*[R t];
%% Graphical Sketch
figure_01 = figure; hold on; grid on;
plot3(C(1), C(2), C(3), 'm.', 'Markersize', 20);
%% Draw all Planes encoded in P
[X, Y, Z] = meshgrid(
(C(1)-5):0.1:(C(1)+5),...
(C(2)-0):0.1:(C(2)+5),...
(C(3)-5):0.1:(C(3)+5));
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
P=
2
0
0
0
0
1
0
2
0
0
0
0
Computer Vision
Version vom 11.05.2015
1-32
%% Camera Matrix
% Intrinsic Camera Parameter
f = 2;
% Focal Length
K = diag([f f 1]); % Intrinsic camera Parameter
K(1, 3) = 3;
K(2, 3) = 2;
% Extrinsic Camera Parameter
C = [3; 2; 1];
% Camera Centre
R = [1 0 0
0 0 1
0 1 0];
% We change x and y coordinates
t = -R*C;
% Translation vector with respect to R and C
% Setup Projection matrix
P = K*[R t];
%% Graphical Sketch
figure_01 = figure; hold on; grid on;
plot3(C(1), C(2), C(3), 'm.', 'Markersize', 20);
%% Draw all Planes encoded in P
[X, Y, Z] = meshgrid(
(C(1)-5):0.1:(C(1)+5),...
(C(2)-0):0.1:(C(2)+5),...
(C(3)-5):0.1:(C(3)+5));
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
P=
2
0
0
3
2
1
0
2
0
-12
-6
-2
Computer Vision
Version vom 11.05.2015
1-33
Computer Vision
Version vom 11.05.2015
1-34
P (computed)
fx = 4.5e-3;
fy = 4.5e-3;
mx = 1/6.5e-6;
my = 1/6.5e-6;
x0 = 640/2;
y0 = 480/2;
ax = fx*mx;
ay = fy*my;
s = 0;
692,3076923076
0
0
692,3076923076
0
0
1
K = [
ax
0
0
s
ay
0
%
%
%
%
Focal
Focal
no of
no of
Length
Length
pixels
pixels
4.5mm
4.5mm
per mm
per mm
320
240
0
0
0
% skew factor
x0;
y0;
1 ];
C = [0; 0; 0];
R = eye(3);
t = -R*C;
P = K*[R t];
disp(P);
3.2435919943e+02
2.4445479377e+02
0
Computer Vision
Version vom 11.05.2015
1-35
Literature
Computer Vision
Version vom 11.05.2015
1-55