15 lines
276 B
Mathematica
15 lines
276 B
Mathematica
function d = distance_homographie(XY1, XY2, H)
|
|
|
|
Hinv = inv(H);
|
|
Hinv = Hinv ./ Hinv(3, 3);
|
|
|
|
XY1_ = appliquerHomographie(H, XY1);
|
|
XY2_ = appliquerHomographie(Hinv, XY2);
|
|
|
|
d1 = sum((XY1_ - XY2).^2, 2);
|
|
d2 = sum((XY2_ - XY1).^2, 2);
|
|
|
|
d = d1 + d2;
|
|
|
|
end
|