void GazeTracker::removeCalibrationError(Point &estimate) { double x[1][2]; double output[1]; double sigma[1]; int pointCount = _calTargets.size() + 4; if (_betaX == -1 && _gammaX == -1) { return; } x[0][0] = estimate.x; x[0][1] = estimate.y; //std::cout << "INSIDE CAL ERR REM. BETA = " << _betaX << ", " << _betaY << ", GAMMA IS " << _gammaX << ", " << _gammaY << std::endl; //for (int i = 0; i < pointCount; i++) { // std::cout << _xv[i][0] << ", " << _xv[i][1] << std::endl; //} int N = pointCount; N = binomialInv(N, 2) - 1; //std::cout << "CALIB. ERROR REMOVAL. Target size: " << pointCount << ", " << N << std::endl; mirEvaluate(1, 2, 1, (double *)x, pointCount, (double *)_xv, _fvX, _sigv, 0, NULL, NULL, NULL, _betaX, _gammaX, N, 2, output, sigma); if (output[0] >= -100) { estimate.x = output[0]; } mirEvaluate(1, 2, 1, (double *)x, pointCount, (double *)_xv, _fvY, _sigv, 0, NULL, NULL, NULL, _betaY, _gammaY, N, 2, output, sigma); if (output[0] >= -100) { estimate.y = output[0]; } //std::cout << "Estimation corrected from: (" << x[0][0] << ", " << x[0][1] << ") to (" << estimate.x << ", " << estimate.y << ")" << std::endl; boundToScreenCoordinates(estimate); //std::cout << "Estimation corrected from: (" << x[0][0] << ", " << x[0][1] << ") to (" << estimate.x << ", " << estimate.y << ")" << std::endl; }
void GazeTracker::removeCalibrationError(Point& estimate) { double x[1][2]; double output[1]; double sigma[1]; int point_count = caltargets.size() + 4; if(beta_x == -1 && gamma_x == -1) return; x[0][0] = estimate.x; x[0][1] = estimate.y; /* cout << "INSIDE CAL ERR REM. BETA = " << beta_x << ", " << beta_y << ", GAMMA IS " << gamma_x << ", " << gamma_y << endl; for(int j=0; j<point_count; j++) { cout << xv[j][0] << ", " << xv[j][1] << endl; } */ int N = point_count; N = binomialInv(N, 2) - 1; //cout << "CALIB. ERROR REMOVAL. Target size: " << point_count << ", " << N << endl; mirEvaluate(1, 2, 1, (double*)x, point_count, (double*)xv, fv_x, sigv, 0, NULL, NULL, NULL, beta_x, gamma_x, N, 2, output, sigma); if(output[0] >= -100) estimate.x = output[0]; mirEvaluate(1, 2, 1, (double*)x, point_count, (double*)xv, fv_y, sigv, 0, NULL, NULL, NULL, beta_y, gamma_y, N, 2, output, sigma); if(output[0] >= -100) estimate.y = output[0]; //cout << "Estimation corrected from: ("<< x[0][0] << ", " << x[0][1] << ") to ("<< estimate.x << ", " << estimate.y << ")" << endl; boundToScreenCoordinates(estimate); //cout << "Estimation corrected from: ("<< x[0][0] << ", " << x[0][1] << ") to ("<< estimate.x << ", " << estimate.y << ")" << endl; }