37 int id = rhs[0].toInt();
38 string method(rhs[1].toString());
41 if (method ==
"new") {
53 if (method ==
"delete") {
58 else if (method ==
"typeid") {
60 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
62 else if (method ==
"clear") {
66 else if (method ==
"load") {
67 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
69 bool loadFromString =
false;
70 for (
int i=3; i<nrhs; i+=2) {
71 string key(rhs[i].toString());
73 objname = rhs[i+1].toString();
74 else if (key ==
"FromString")
75 loadFromString = rhs[i+1].toBool();
78 "Unrecognized option %s", key.
c_str());
80 obj_[id] = (loadFromString ?
81 Algorithm::loadFromString<GFTTDetector>(rhs[2].toString(), objname) :
82 Algorithm::load<GFTTDetector>(rhs[2].toString(), objname));
84 else if (method ==
"save") {
86 obj->
save(rhs[2].toString());
88 else if (method ==
"empty") {
92 else if (method ==
"getDefaultName") {
96 else if (method ==
"detect") {
97 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
98 if (rhs[2].isNumeric()) {
100 for (
int i=3; i<nrhs; i+=2) {
101 string key(rhs[i].toString());
103 mask = rhs[i+1].toMat(
CV_8U);
106 "Unrecognized option %s", key.
c_str());
110 obj->
detect(image, keypoints, mask);
113 else if (rhs[2].isCell()) {
115 for (
int i=3; i<nrhs; i+=2) {
116 string key(rhs[i].toString());
127 "Unrecognized option %s", key.
c_str());
138 obj->
detect(images, keypoints, masks);
144 else if (method ==
"get") {
146 string prop(rhs[2].toString());
147 if (prop ==
"BlockSize")
149 else if (prop ==
"HarrisDetector")
151 else if (prop ==
"K")
153 else if (prop ==
"MaxFeatures")
155 else if (prop ==
"MinDistance")
157 else if (prop ==
"QualityLevel")
161 "Unrecognized property %s", prop.
c_str());
163 else if (method ==
"set") {
165 string prop(rhs[2].toString());
166 if (prop ==
"BlockSize")
168 else if (prop ==
"HarrisDetector")
170 else if (prop ==
"K")
171 obj->
setK(rhs[3].toDouble());
172 else if (prop ==
"MaxFeatures")
174 else if (prop ==
"MinDistance")
176 else if (prop ==
"QualityLevel")
180 "Unrecognized property %s", prop.
c_str());
189 "Unrecognized operation %s",method.
c_str());
virtual void setK(double k)=0
map< int, Ptr< GFTTDetector > > obj_
Object container.
virtual void setHarrisDetector(bool val)=0
virtual double getQualityLevel() const=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual void detect(InputArray image, std::vector< KeyPoint > &keypoints, InputArray mask=noArray())
cv::Ptr< cv::GFTTDetector > createGFTTDetector(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of GFTTDetector using options in arguments.
struct mxArray_tag mxArray
Forward declaration for mxArray.
virtual void setBlockSize(int blockSize)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
LIBMWMEX_API_EXTERN_C void mexErrMsgIdAndTxt(const char *identifier, const char *err_msg,...)
Issue formatted error message with corresponding error identifier and return to MATLAB prompt...
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual bool getHarrisDetector() const=0
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Common definitions for the features2d and xfeatures2d modules.
virtual String getDefaultName() const
virtual void setQualityLevel(double qlevel)=0
Global constant definitions.
virtual void setMaxFeatures(int maxFeatures)=0
virtual void setMinDistance(double minDistance)=0
virtual bool empty() const
virtual void save(const String &filename) const
virtual int getMaxFeatures() const=0
int last_id
Last object id to allocate.
virtual int getBlockSize() const=0
virtual double getMinDistance() const=0
virtual double getK() const=0