|
OpenCV 2.4.8 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.core.Algorithm
public class Algorithm
class CV_EXPORTS_W Algorithm
// C++ code:
public:
Algorithm();
virtual ~Algorithm();
string name() const;
template
template
CV_WRAP int getInt(const string& name) const;
CV_WRAP double getDouble(const string& name) const;
CV_WRAP bool getBool(const string& name) const;
CV_WRAP string getString(const string& name) const;
CV_WRAP Mat getMat(const string& name) const;
CV_WRAP vector
CV_WRAP Ptr
void set(const string& name, int value);
void set(const string& name, double value);
void set(const string& name, bool value);
void set(const string& name, const string& value);
void set(const string& name, const Mat& value);
void set(const string& name, const vector
void set(const string& name, const Ptr
template
CV_WRAP void setInt(const string& name, int value);
CV_WRAP void setDouble(const string& name, double value);
CV_WRAP void setBool(const string& name, bool value);
CV_WRAP void setString(const string& name, const string& value);
CV_WRAP void setMat(const string& name, const Mat& value);
CV_WRAP void setMatVector(const string& name, const vector
CV_WRAP void setAlgorithm(const string& name, const Ptr
template
void set(const char* name, int value);
void set(const char* name, double value);
void set(const char* name, bool value);
void set(const char* name, const string& value);
void set(const char* name, const Mat& value);
void set(const char* name, const vector
void set(const char* name, const Ptr
template
void setInt(const char* name, int value);
void setDouble(const char* name, double value);
void setBool(const char* name, bool value);
void setString(const char* name, const string& value);
void setMat(const char* name, const Mat& value);
void setMatVector(const char* name, const vector
void setAlgorithm(const char* name, const Ptr
template
CV_WRAP string paramHelp(const string& name) const;
int paramType(const char* name) const;
CV_WRAP int paramType(const string& name) const;
CV_WRAP void getParams(CV_OUT vector
virtual void write(FileStorage& fs) const;
virtual void read(const FileNode& fn);
typedef Algorithm* (*Constructor)(void);
typedef int (Algorithm.*Getter)() const;
typedef void (Algorithm.*Setter)(int);
CV_WRAP static void getList(CV_OUT vector
CV_WRAP static Ptr
template
virtual AlgorithmInfo* info() const / * TODO: make it = 0;* / { return 0; }
};
This is a base class for all more or less complex algorithms in OpenCV, especially for classes of algorithms, for which there can be multiple implementations. The examples are stereo correspondence (for which there are algorithms like block matching, semi-global block matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck etc.).
The class provides the following features for all derived classes:
Algorithm.create
). If you plan to add your own algorithms, it
is good practice to add a unique prefix to your algorithms to distinguish
them from other algorithms.
cvSetCaptureProperty()
, cvGetCaptureProperty()
,
VideoCapture.set()
and VideoCapture.get()
.
Algorithm
provides similar method where instead of integer id's
you specify the parameter names as text strings. See Algorithm.set
and Algorithm.get
for details.
Here is example of SIFT use in your application via Algorithm interface:
// C++ code:
#include "opencv2/opencv.hpp"
#include "opencv2/nonfree/nonfree.hpp"...
initModule_nonfree(); // to load SURF/SIFT etc.
Ptr
FileStorage fs("sift_params.xml", FileStorage.READ);
if(fs.isOpened()) // if we have file with parameters, read them
sift->read(fs["sift_params"]);
fs.release();
else // else modify the parameters and store them; user can later edit the file to use different parameters
sift->set("contrastThreshold", 0.01f); // lower the contrast threshold, compared to the default value
WriteStructContext ws(fs, "sift_params", CV_NODE_MAP);
sift->write(fs);
Mat image = imread("myimage.png", 0), descriptors;
vector
(*sift)(image, noArray(), keypoints, descriptors);
Method Summary | |
---|---|
boolean |
getBool(java.lang.String name)
|
double |
getDouble(java.lang.String name)
|
int |
getInt(java.lang.String name)
|
Mat |
getMat(java.lang.String name)
|
java.util.List<Mat> |
getMatVector(java.lang.String name)
|
java.lang.String |
getString(java.lang.String name)
|
java.lang.String |
paramHelp(java.lang.String name)
|
int |
paramType(java.lang.String name)
|
void |
setBool(java.lang.String name,
boolean value)
|
void |
setDouble(java.lang.String name,
double value)
|
void |
setInt(java.lang.String name,
int value)
|
void |
setMat(java.lang.String name,
Mat value)
|
void |
setMatVector(java.lang.String name,
java.util.List<Mat> value)
|
void |
setString(java.lang.String name,
java.lang.String value)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public boolean getBool(java.lang.String name)
public double getDouble(java.lang.String name)
public int getInt(java.lang.String name)
public Mat getMat(java.lang.String name)
public java.util.List<Mat> getMatVector(java.lang.String name)
public java.lang.String getString(java.lang.String name)
public java.lang.String paramHelp(java.lang.String name)
public int paramType(java.lang.String name)
public void setBool(java.lang.String name, boolean value)
public void setDouble(java.lang.String name, double value)
public void setInt(java.lang.String name, int value)
public void setMat(java.lang.String name, Mat value)
public void setMatVector(java.lang.String name, java.util.List<Mat> value)
public void setString(java.lang.String name, java.lang.String value)
|
OpenCV 2.4.8 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |