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<AKAZE>(rhs[2].toString(), objname) :
82 Algorithm::load<AKAZE>(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 ==
"defaultNorm") {
100 else if (method ==
"descriptorSize") {
104 else if (method ==
"descriptorType") {
108 else if (method ==
"detect") {
109 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
110 if (rhs[2].isNumeric()) {
112 for (
int i=3; i<nrhs; i+=2) {
113 string key(rhs[i].toString());
115 mask = rhs[i+1].toMat(
CV_8U);
118 "Unrecognized option %s", key.
c_str());
123 obj->
detect(image, keypoints, mask);
126 else if (rhs[2].isCell()) {
128 for (
int i=3; i<nrhs; i+=2) {
129 string key(rhs[i].toString());
140 "Unrecognized option %s", key.
c_str());
152 obj->
detect(images, keypoints, masks);
158 else if (method ==
"compute") {
160 if (rhs[2].isNumeric()) {
165 obj->
compute(image, keypoints, descriptors);
166 plhs[0] =
MxArray(descriptors);
170 else if (rhs[2].isCell()) {
182 &MxArray::toVector<KeyPoint>)));
183 obj->
compute(images, keypoints, descriptors);
184 plhs[0] =
MxArray(descriptors);
191 else if (method ==
"detectAndCompute") {
192 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=2);
195 bool useProvidedKeypoints =
false;
196 for (
int i=3; i<nrhs; i+=2) {
197 string key(rhs[i].toString());
199 mask = rhs[i+1].toMat(
CV_8U);
200 else if (key ==
"Keypoints") {
201 keypoints = rhs[i+1].toVector<
KeyPoint>();
202 useProvidedKeypoints =
true;
206 "Unrecognized option %s", key.
c_str());
212 useProvidedKeypoints);
215 plhs[1] =
MxArray(descriptors);
217 else if (method ==
"get") {
219 string prop(rhs[2].toString());
220 if (prop ==
"DescriptorChannels")
222 else if (prop ==
"DescriptorSize")
224 else if (prop ==
"DescriptorType")
226 else if (prop ==
"Diffusivity")
228 else if (prop ==
"NOctaveLayers")
230 else if (prop ==
"NOctaves")
232 else if (prop ==
"Threshold")
236 "Unrecognized property %s", prop.
c_str());
238 else if (method ==
"set") {
240 string prop(rhs[2].toString());
241 if (prop ==
"DescriptorChannels")
243 else if (prop ==
"DescriptorSize")
245 else if (prop ==
"DescriptorType")
247 else if (prop ==
"Diffusivity")
249 else if (prop ==
"NOctaveLayers")
251 else if (prop ==
"NOctaves")
253 else if (prop ==
"Threshold")
257 "Unrecognized property %s", prop.
c_str());
261 "Unrecognized operation %s",method.
c_str());
virtual void setNOctaves(int octaves)=0
virtual int getDescriptorType() const=0
const ConstMap< std::string, int > KAZEDiffusivityType
KAZE Diffusivity type.
virtual void setDescriptorSize(int dsize)=0
virtual int descriptorType() const
virtual int getDiffusivity() const=0
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
cv::Ptr< cv::AKAZE > createAKAZE(std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Create an instance of AKAZE using options in arguments.
virtual int getNOctaves() const=0
virtual int getNOctaveLayers() const=0
const ConstMap< std::string, int > AKAZEDescriptorType
AKAZE descriptor type.
const ConstMap< int, std::string > NormTypeInv
Inverse norm type map for option processing.
virtual void setNOctaveLayers(int octaveLayers)=0
virtual void detect(InputArray image, std::vector< KeyPoint > &keypoints, InputArray mask=noArray())
struct mxArray_tag mxArray
Forward declaration for mxArray.
map< int, Ptr< AKAZE > > obj_
Object container.
virtual void setDiffusivity(int diff)=0
virtual int defaultNorm() 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.
virtual void setDescriptorChannels(int dch)=0
virtual int descriptorSize() const
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.
const ConstMap< int, std::string > KAZEDiffusivityTypeInv
inverse KAZE Diffusivity type
virtual void detectAndCompute(InputArray image, InputArray mask, std::vector< KeyPoint > &keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)
const ConstMap< int, std::string > ClassNameInvMap
Translates data type definition used in OpenCV to that of MATLAB.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual int getDescriptorSize() const=0
Global constant definitions.
virtual void setThreshold(double threshold)=0
int last_id
Last object id to allocate.
const ConstMap< int, std::string > AKAZEDescriptorTypeInv
inverse AKAZE descriptor type
virtual void compute(InputArray image, std::vector< KeyPoint > &keypoints, OutputArray descriptors)
virtual double getThreshold() const=0
virtual bool empty() const
virtual void save(const String &filename) const
virtual void setDescriptorType(int dtype)=0
virtual int getDescriptorChannels() const=0
virtual String getDefaultName() const