Home > 05-08-Geometry > demo_single_image_geometry.m

demo_single_image_geometry

PURPOSE ^

% DEMO single image geometry

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% DEMO single image geometry

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

 last changes: Susanne Wenzel 07/17
 wenzel@igg.uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% DEMO single image geometry
0002 %
0003 % Wolfgang Förstner
0004 % wfoerstn@uni-bonn.de
0005 %
0006 % last changes: Susanne Wenzel 07/17
0007 % wenzel@igg.uni-bonn.de
0008 
0009 clc
0010 close all
0011 
0012 addpath(genpath('../General-Functions'))
0013 
0014 fprintf('\n------ DEMO Single Image Geometry ------\n')
0015 
0016 fprintf('\nIn order to shorten the output, we display transposed vectors\n')
0017 
0018 %% Given
0019 
0020 fprintf('\nGiven:\n')
0021 
0022 % object point
0023 fprintf('\n3D object point\n')
0024 X = [3,2,5,6]'; disp(['X = [', num2str(X'./X(end)),']'])
0025 
0026 % Interior orientation, calibration parameters
0027 c = 1;  % camera constant
0028 s = 0;  % shear
0029 xH = 0; % principal point
0030 yH = 0;
0031 m = 0;  % scale difference
0032 
0033 % exterior orentation
0034 fprintf('\nProjection center\n')
0035 X0 = [1,2,3,1]'; disp(['XO = [', num2str(X0'),']'])
0036 % rotation, rotation vector (r tan(phi/2))
0037 r=[0,0,0]';
0038 
0039 
0040 fprintf('\nInterior orientaion, calibration matrix\n')
0041 K = [c,s*c,xH;0,c*(1+m),yH;0,0,1]                                          %#ok<NOPTS>
0042 
0043 fprintf('\nExterior orientaion, rotation matrix\n')
0044 R = calc_Rot_r(r)                                                          %#ok<NOPTS>
0045 
0046 %% Projection matrix for points, P = K R [I | -XO]
0047 fprintf('\nProjection matrix for points, P = K R [I | -XO]\n')
0048 P = calc_P_from_KRZ(K,R,X0(1:3)/X0(4))                                     %#ok<NOPTS>
0049 
0050 %% Projection matrix for 3D-lines, see PCV Eq.(12.71)
0051 fprintf('\nProjection matrix for 3D-lines, see PCV Eq.(12.71)\n')
0052 Q = calc_Q_from_P(P)                                                       %#ok<NOPTS>
0053 
0054 %% Projection of image point
0055 fprintf('\nProjection of object point --> homogeneous coordiantes of image point\n')
0056 xh = P*X; disp(['x_h = [', num2str(xh'),']'])
0057 
0058 fprintf('\nEuclidian coordinates of image point\n')
0059 xe = xh(1:2)/xh(3); disp(['x = [', num2str(xe'),']'])
0060 
0061 %% Projection ray in Plücker coordiantes
0062 fprintf('\nProjection ray in Plücker coordiantes\n')
0063 Lxs = calc_Dual*Q'*xh ; disp(['L_xs = [', num2str(Lxs'),']'])
0064 
0065 fprintf('\nCheck  whether projection ray passes through 3D-point: should be 0\n')
0066 test_val = calc_Gammadual(Lxs) * X ; disp(['[', num2str(test_val'),']'])
0067 
0068

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005