37 int id = rhs[0].toInt();
38 string method(rhs[1].toString());
41 if (method ==
"new") {
54 if (method ==
"delete") {
59 else if (method ==
"typeid") {
61 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
63 else if (method ==
"clear") {
67 else if (method ==
"load") {
68 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
70 bool loadFromString =
false;
71 for (
int i=3; i<nrhs; i+=2) {
72 string key(rhs[i].toString());
74 objname = rhs[i+1].toString();
75 else if (key ==
"FromString")
76 loadFromString = rhs[i+1].toBool();
79 "Unrecognized option %s", key.
c_str());
81 obj_[id] = (loadFromString ?
82 Algorithm::loadFromString<FastFeatureDetector>(rhs[2].toString(), objname) :
83 Algorithm::load<FastFeatureDetector>(rhs[2].toString(), objname));
85 else if (method ==
"save") {
87 obj->
save(rhs[2].toString());
89 else if (method ==
"empty") {
93 else if (method ==
"getDefaultName") {
97 else if (method ==
"detect") {
98 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
99 if (rhs[2].isNumeric()) {
101 for (
int i=3; i<nrhs; i+=2) {
102 string key(rhs[i].toString());
104 mask = rhs[i+1].toMat(
CV_8U);
107 "Unrecognized option %s", key.
c_str());
111 obj->
detect(image, keypoints, mask);
114 else if (rhs[2].isCell()) {
116 for (
int i=3; i<nrhs; i+=2) {
117 string key(rhs[i].toString());
128 "Unrecognized option %s", key.
c_str());
139 obj->
detect(images, keypoints, masks);
145 else if (method ==
"get") {
147 string prop(rhs[2].toString());
148 if (prop ==
"NonmaxSuppression")
150 else if (prop ==
"Threshold")
152 else if (prop ==
"Type")
156 "Unrecognized property %s", prop.
c_str());
158 else if (method ==
"set") {
160 string prop(rhs[2].toString());
161 if (prop ==
"NonmaxSuppression")
163 else if (prop ==
"Threshold")
165 else if (prop ==
"Type")
169 "Unrecognized property %s", prop.
c_str());
178 "Unrecognized operation %s",method.
c_str());
virtual void setNonmaxSuppression(bool f)=0
virtual void setType(int type)=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
virtual int getThreshold() const=0
virtual void detect(InputArray image, std::vector< KeyPoint > &keypoints, InputArray mask=noArray())
struct mxArray_tag mxArray
Forward declaration for mxArray.
cv::Ptr< cv::FastFeatureDetector > createFastFeatureDetector(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of FastFeatureDetector using options in arguments.
virtual int getType() const=0
virtual bool getNonmaxSuppression() const=0
virtual String getDefaultName() const
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.
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.
Global constant definitions.
virtual void setThreshold(int threshold)=0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
int last_id
Last object id to allocate.
map< int, Ptr< FastFeatureDetector > > obj_
Object container.
virtual bool empty() const
virtual void save(const String &filename) const
const ConstMap< int, std::string > FASTTypeMapInv
inverse FAST types
const ConstMap< std::string, int > FASTTypeMap
FAST types.