/// Constructor, initializing \c logalpha0_ HomographyModel::HomographyModel(const Mat &x1, int w1, int h1, const Mat &x2, int w2, int h2, bool symError) : OrsaModel(x1, w1, h1, x2, w2, h2), symError_(symError) { logalpha0_[0] = log10(M_PI/(w1*(double)h1) /(N1_(0,0)*N1_(0,0))); logalpha0_[1] = log10(M_PI/(w2*(double)h2) /(N2_(0,0)*N2_(0,0))); }
/// Constructor, computing logalpha0_ FundamentalModel::FundamentalModel(const Mat &x1, int w1, int h1, const Mat &x2, int w2, int h2, bool symError) : OrsaModel(x1, w1, h1, x2, w2, h2), symError_(symError) { double D, A; // Diameter and area of image D = sqrt(w1*(double)w1 + h1*(double)h1); A = w1*(double)h1; logalpha0_[0] = log10(2.0*D/A /N1_(0,0)); D = sqrt(w2*(double)w2 + h2*(double)h2); A = w2*(double)h2; logalpha0_[1] = log10(2.0*D/A /N2_(0,0)); }
std::vector<double> SOElement::getc(std::size_t ielem) const { auto const xl = coords_[lnods_[ielem][1]] - coords_[lnods_[ielem][0]]; std::vector<double> c(ntnoel_); c[0] = gl_.qgauss( myfunctional::make_functional( [this, ielem](double r) { return - N1_(r) * func_(N1_(r) * coords_[lnods_[ielem][0]] + N2_(r) * coords_[lnods_[ielem][1]] + N3_(r) * coords_[lnods_[ielem][2]]); }), -1.0, 1.0) * xl * 0.5; c[1] = gl_.qgauss( myfunctional::make_functional([this, ielem](double r) { return - N2_(r) * func_(N1_(r) * coords_[lnods_[ielem][0]] + N2_(r) * coords_[lnods_[ielem][1]] + N3_(r) * coords_[lnods_[ielem][2]]); }), -1.0, 1.0) * xl * 0.5; c[2] = gl_.qgauss( myfunctional::make_functional([this, ielem](double r) { return - N3_(r) * func_(N1_(r) * coords_[lnods_[ielem][0]] + N2_(r) * coords_[lnods_[ielem][1]] + N3_(r) * coords_[lnods_[ielem][2]]); }), -1.0, 1.0) * xl * 0.5; return c; }
/// Denormalize error, recover real error in pixels. double OrsaModel::denormalizeError(double squareError, int side) const { return sqrt(squareError)/(side==0? N1_(0,0): N2_(0,0)); }
double unormalizeError(double val) const {return sqrt(val) / N1_(0,0);}