OpenCV 4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::MinProblemSolver Class Referenceabstract

Basic interface for all solvers. More...

#include <opencv2/core/optim.hpp>

Collaboration diagram for cv::MinProblemSolver:

Classes

class  Function
 Represents function being optimized. More...
 

Public Member Functions

virtual Ptr< FunctiongetFunction () const =0
 Getter for the optimized function.
 
virtual TermCriteria getTermCriteria () const =0
 Getter for the previously set terminal criteria for this algorithm.
 
virtual double minimize (InputOutputArray x)=0
 actually runs the algorithm and performs the minimization.
 
virtual void setFunction (const Ptr< Function > &f)=0
 Setter for the optimized function.
 
virtual void setTermCriteria (const TermCriteria &termcrit)=0
 Set terminal criteria for solver.
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage.
 
virtual void save (const String &filename) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
 
void write (FileStorage &fs, const String &name) const
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

Basic interface for all solvers.

Member Function Documentation

◆ getFunction()

virtual Ptr< Function > cv::MinProblemSolver::getFunction ( ) const
pure virtual

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.

Returns
Smart-pointer to an object that implements Function interface - it represents the function that is being optimized. It can be empty, if no function was given so far.

◆ getTermCriteria()

virtual TermCriteria cv::MinProblemSolver::getTermCriteria ( ) const
pure virtual

Getter for the previously set terminal criteria for this algorithm.

Returns
Deep copy of the terminal criteria used at the moment.

◆ minimize()

virtual double cv::MinProblemSolver::minimize ( InputOutputArray x)
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.

Parameters
xThe 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.
Returns
The value of a function at the point found.

◆ setFunction()

virtual void cv::MinProblemSolver::setFunction ( const Ptr< Function > & f)
pure virtual

Setter for the optimized function.

It should be called at least once before the call to* minimize(), as default value is not usable.

Parameters
fThe new function to optimize.

◆ setTermCriteria()

virtual void cv::MinProblemSolver::setTermCriteria ( const TermCriteria & termcrit)
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.

Parameters
termcritTerminal criteria to be used, represented as cv::TermCriteria structure.

The documentation for this class was generated from the following file: