195void vpHomography::DLT(
const std::vector<double> &xb,
const std::vector<double> &yb,
const std::vector<double> &xa,
196 const std::vector<double> &ya,
vpHomography &aHb,
bool normalization)
198 unsigned int n =
static_cast<unsigned int>(xb.size());
199 if ((yb.size() != n) || (xa.size() != n) || (ya.size() != n)) {
204 const unsigned int nbRequiredPoints = 4;
205 if (n < nbRequiredPoints) {
209 std::vector<double> xan, yan, xbn, ybn;
211 double xg1 = 0., yg1 = 0., coef1 = 0., xg2 = 0., yg2 = 0., coef2 = 0.;
216 vpHomography::hartleyNormalization(xb, yb, xbn, ybn, xg1, yg1, coef1);
217 vpHomography::hartleyNormalization(xa, ya, xan, yan, xg2, yg2, coef2);
240 for (
unsigned int i = 0; i < n; ++i) {
244 A[2 * i][3] = -xbn[i];
245 A[2 * i][4] = -ybn[i];
247 A[2 * i][6] = xbn[i] * yan[i];
248 A[2 * i][7] = ybn[i] * yan[i];
249 A[2 * i][8] = yan[i];
251 A[(2 * i) + 1][0] = xbn[i];
252 A[(2 * i) + 1][1] = ybn[i];
253 A[(2 * i) + 1][2] = 1;
254 A[(2 * i) + 1][3] = 0;
255 A[(2 * i) + 1][4] = 0;
256 A[(2 * i) + 1][5] = 0;
257 A[(2 * i) + 1][6] = -xbn[i] * xan[i];
258 A[(2 * i) + 1][7] = -ybn[i] * xan[i];
259 A[(2 * i) + 1][8] = -xan[i];
264 for (
unsigned int i = 0; i < 9; ++i) {
276 for (
unsigned int i = 0; i < 9; ++i) {
288 double smallestSv = 1e30;
289 unsigned int indexSmallestSv = 0;
290 for (
unsigned int i = 0; i < 9; ++i) {
291 if (D[i] < smallestSv) {
297 h = V.
getCol(indexSmallestSv);
300 const unsigned int val_3 = 3;
301 for (
unsigned int i = 0; i < val_3; ++i) {
302 for (
unsigned int j = 0; j < val_3; ++j) {
303 aHbn[i][j] = h[(3 * i) + j];
309 vpHomography::hartleyDenormalization(aHbn, aHb, xg1, yg1, coef1, xg2, yg2, coef2);
static void DLT(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, vpHomography &aHb, bool normalization=true)