38 int id = rhs[0].toInt();
39 string method(rhs[1].toString());
42 if (method ==
"new") {
55 if (method ==
"delete") {
60 else if (method ==
"typeid") {
62 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
64 else if (method ==
"clear") {
68 else if (method ==
"load") {
69 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
71 bool loadFromString =
false;
72 for (
int i=3; i<nrhs; i+=2) {
73 string key(rhs[i].toString());
75 objname = rhs[i+1].toString();
76 else if (key ==
"FromString")
77 loadFromString = rhs[i+1].toBool();
80 "Unrecognized option %s", key.
c_str());
82 obj_[id] = (loadFromString ?
83 Algorithm::loadFromString<HarrisLaplaceFeatureDetector>(rhs[2].toString(), objname) :
84 Algorithm::load<HarrisLaplaceFeatureDetector>(rhs[2].toString(), objname));
86 else if (method ==
"save") {
88 obj->
save(rhs[2].toString());
90 else if (method ==
"empty") {
94 else if (method ==
"getDefaultName") {
98 else if (method ==
"detect") {
99 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
100 if (rhs[2].isNumeric()) {
102 for (
int i=3; i<nrhs; i+=2) {
103 string key(rhs[i].toString());
105 mask = rhs[i+1].toMat(
CV_8U);
108 "Unrecognized option %s", key.
c_str());
112 obj->
detect(image, keypoints, mask);
115 else if (rhs[2].isCell()) {
117 for (
int i=3; i<nrhs; i+=2) {
118 string key(rhs[i].toString());
129 "Unrecognized option %s", key.
c_str());
140 obj->
detect(images, keypoints, masks);
153 "Unrecognized operation %s",method.
c_str());
int last_id
Last object id to allocate.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual void detect(InputArray image, std::vector< KeyPoint > &keypoints, InputArray mask=noArray())
struct mxArray_tag mxArray
Forward declaration for mxArray.
map< int, Ptr< HarrisLaplaceFeatureDetector > > obj_
Object container.
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.
virtual String getDefaultName() const
Global constant definitions.
virtual bool empty() const
virtual void save(const String &filename) const
cv::Ptr< cv::xfeatures2d::HarrisLaplaceFeatureDetector > createHarrisLaplaceFeatureDetector(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of HarrisLaplaceFeatureDetector using options in arguments.