这个方程实际上在几何算法中很常见,本质上,你试图从方程AXB=0计算矩阵X。为了解决这个问题,你对方程进行矢量化,这意味着,

vec() 表示矩阵的向量化形式,即简单地将矩阵的列一个一个地堆叠起来以产生一个单一的列向量。如果你不知道这个看起来很吓人的符号的含义,它被称为 Kronecker 产品,你可以从这里阅读它,它很简单,相信我 :-)
现在,假设我将B^T和A的 Kronecker 乘积获得的矩阵称为C。然后,vec(X)是矩阵C的零向量,获得它的方法是通过对C^TC进行SVD 分解(C 转置乘以 C)并取矩阵V的最后一列。最后一列只不过是您的vec(X)。将 X 重塑为 3 x 3 矩阵。这是你的基本矩阵。
如果你觉得这个数学太难编码,只需使用 Y.Ma et.al 的以下代码:
% p are homogenius coordinates of the first image of size 3 by n
% q are homogenius coordinates of the second image of size 3 by n
function [E] = essentialDiscrete(p,q)
n = size(p);
NPOINTS = n(2);
% set up matrix A such that A*[v1,v2,v3,s1,s2,s3,s4,s5,s6]' = 0
A = zeros(NPOINTS, 9);
if NPOINTS < 9
error('Too few mesurements')
return;
end
for i = 1:NPOINTS
A(i,:) = kron(p(:,i),q(:,i))';
end
r = rank(A);
if r < 8
warning('Measurement matrix rank defficient')
T0 = 0; R = [];
end;
[U,S,V] = svd(A);
% pick the eigenvector corresponding to the smallest eigenvalue
e = V(:,9);
e = (round(1.0e+10*e))*(1.0e-10);
% essential matrix
E = reshape(e, 3, 3);