OpenCV
4.5.4dev
Open Source Computer Vision

Basic interface for all solvers. More...
#include <opencv2/core/optim.hpp>
Classes  
class  Function 
Represents function being optimized. More...  
Public Member Functions  
virtual Ptr< Function >  getFunction () const =0 
Getter for the optimized function. More...  
virtual TermCriteria  getTermCriteria () const =0 
Getter for the previously set terminal criteria for this algorithm. More...  
virtual double  minimize (InputOutputArray x)=0 
actually runs the algorithm and performs the minimization. More...  
virtual void  setFunction (const Ptr< Function > &f)=0 
Setter for the optimized function. More...  
virtual void  setTermCriteria (const TermCriteria &termcrit)=0 
Set terminal criteria for solver. More...  
Public Member Functions inherited from cv::Algorithm  
Algorithm ()  
virtual  ~Algorithm () 
virtual void  clear () 
Clears the algorithm state. More...  
virtual bool  empty () const 
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...  
virtual String  getDefaultName () const 
virtual void  read (const FileNode &fn) 
Reads algorithm parameters from a file storage. More...  
virtual void  save (const String &filename) const 
virtual void  write (FileStorage &fs) const 
Stores algorithm parameters in a file storage. More...  
void  write (const Ptr< FileStorage > &fs, const String &name=String()) const 
simplified API for language bindings This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...  
Additional Inherited Members  
Static Public Member Functions inherited from cv::Algorithm  
template<typename _Tp >  
static Ptr< _Tp >  load (const String &filename, const String &objname=String()) 
Loads algorithm from the file. More...  
template<typename _Tp >  
static Ptr< _Tp >  loadFromString (const String &strModel, const String &objname=String()) 
Loads algorithm from a String. More...  
template<typename _Tp >  
static Ptr< _Tp >  read (const FileNode &fn) 
Reads algorithm from the file node. More...  
Protected Member Functions inherited from cv::Algorithm  
void  writeFormat (FileStorage &fs) const 
Basic interface for all solvers.
Getter for the optimized function.
The optimized function is represented by Function interface, which requires derivatives to implement the calc(double*) and getDim() methods to evaluate the function.

pure virtual 
Getter for the previously set terminal criteria for this algorithm.

pure virtual 
actually runs the algorithm and performs the minimization.
The sole input parameter determines the centroid of the starting simplex (roughly, it tells where to start), all the others (terminal criteria, initial step, function to be minimized) are supposed to be set via the setters before the call to this method or the default values (not always sensible) will be used.
x  The initial point, that will become a centroid of an initial simplex. After the algorithm will terminate, it will be set to the point where the algorithm stops, the point of possible minimum. 
Setter for the optimized function.
It should be called at least once before the call to* minimize(), as default value is not usable.
f  The new function to optimize. 

pure virtual 
Set terminal criteria for solver.
This method is not necessary to be called before the first call to minimize(), as the default value is sensible.
Algorithm stops when the number of function evaluations done exceeds termcrit.maxCount, when the function values at the vertices of simplex are within termcrit.epsilon range or simplex becomes so small that it can enclosed in a box with termcrit.epsilon sides, whatever comes first.
termcrit  Terminal criteria to be used, represented as cv::TermCriteria structure. 