|
|
|
@ -54,7 +54,6 @@ public: |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
virtual ~Function() {} |
|
|
|
|
//! ndim - dimensionality
|
|
|
|
|
virtual double calc(const double* x) const = 0; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -86,6 +85,23 @@ CV_EXPORTS_W Ptr<DownhillSolver> createDownhillSolver(const Ptr<Solver::Function |
|
|
|
|
InputArray initStep=Mat_<double>(1,1,0.0), |
|
|
|
|
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001)); |
|
|
|
|
|
|
|
|
|
//! conjugate gradient method
|
|
|
|
|
class CV_EXPORTS ConjGradSolver : public Solver |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
class CV_EXPORTS Function : public Solver::Function |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
//! gradient is like the first derivative for multivar function
|
|
|
|
|
virtual void getGradient(const double* x,double* buf)const=0; |
|
|
|
|
//! Jacobian is like the second derivative
|
|
|
|
|
virtual void getJacobian(const double* x)const=0; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
CV_EXPORTS_W Ptr<ConjGradSolver> createConjGradSolver(const Ptr<Solver::Function>& f=Ptr<ConjGradSolver::Function>(), |
|
|
|
|
TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5000,0.000001)); |
|
|
|
|
|
|
|
|
|
//!the return codes for solveLP() function
|
|
|
|
|
enum
|
|
|
|
|
{ |
|
|
|
|