📄 gethifrom7params.m
字号:
function [H0, H1] = GetHiFrom7Params(Vector);
% GETHIFROM7PARAMS Return the projective transformation matrices(prewarping transforms)
% from the 7 parameters: [f(x1), f(x2), ..., f(xn)],通过7个参数计算投影变换矩阵
% Vector: 七个参数[alfa, a, b, e0x, e0y, e1x, e1y]的初始值组成的向量
% H0, H1: the projective transformation matrices
%
% Ran Liu: liuran781101@tom.com
% College of Computer Science, Chongqing University
% Panovasic Technology Co.,Ltd
alfa = Vector(1);
a = Vector(2);
b = Vector(3);
e0x = Vector(4);
e0y = Vector(5);
e1x = Vector(6);
e1y = Vector(7);
d0x = e0y / sqrt(e0x^2 + e0y^2);
d0y = -e0x / sqrt(e0x^2 + e0y^2);
d1x = cos(alfa);
d1y = sin(alfa);
theta0 = atan(1 / (d0y * e0x - d0x * e0y)); % 计算theta0: I0的深度旋转角度
R0Planes = MatAlignImgPlanes(theta0, d0x, d0y); % 计算图像平面I0旋转变换矩阵
e0New = R0Planes * [e0x; e0y; 1]; % 计算变换后的e0的坐标
beta0 = -atan(e0New(2) / e0New(1)); % 计算参数beta0: I0中的极线旋转角度
R0Lines = MatAlignScanlines(beta0); % 计算I0中的极线旋转变换矩阵
theta1 = atan(1 / (d1y * e1x - d1x * e1y)); % 计算theta1: I1的深度旋转角度
R1Planes = MatAlignImgPlanes(theta1, d1x, d1y); % 计算图像平面I1旋转变换矩阵
e1New = R1Planes * [e1x; e1y; 1]; % 计算变换后的e1的坐标
beta1 = -atan(e1New(2) / e1New(1)); % 计算参数beta1: I1中的极线旋转角度
R1Lines = MatAlignScanlines(beta1); % 计算I1中的极线旋转变换矩阵。
% 由于在函数InitialParams已经保证a >
% 0,因此这里代beta1
T = [1 0 0
0 a b
0 0 1 ];
% 计算Hi
H0 = R0Lines * R0Planes;
H1 = T * R1Lines * R1Planes;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -