38 int id = rhs[0].toInt();
39 string method(rhs[1].toString());
42 if (method ==
"new") {
45 rhs[2].toString(), rhs.
begin() + 3, rhs.
end());
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());
89 FileStorage fs(rhs[2].toString(), FileStorage::READ +
90 (loadFromString ? FileStorage::MEMORY : 0));
99 else if (method ==
"save") {
103 obj->
save(rhs[2].toString());
105 else if (method ==
"empty") {
109 else if (method ==
"getDefaultName") {
113 else if (method ==
"defaultNorm") {
117 else if (method ==
"descriptorSize") {
121 else if (method ==
"descriptorType") {
125 else if (method ==
"compute") {
127 if (rhs[2].isNumeric()) {
130 obj->
compute(image, keypoints, descriptors);
131 plhs[0] =
MxArray(descriptors);
135 else if (rhs[2].isCell()) {
146 &MxArray::toVector<KeyPoint>)));
147 obj->
compute(images, keypoints, descriptors);
148 plhs[0] =
MxArray(descriptors);
159 "Unrecognized operation %s",method.
c_str());
virtual int descriptorType() const
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
cv::Ptr< cv::DescriptorExtractor > createDescriptorExtractor(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Factory function for DescriptorExtractor creation.
const ConstMap< int, std::string > NormTypeInv
Inverse norm type map for option processing.
void read(const String &fileName)
virtual bool isOpened() const
struct mxArray_tag mxArray
Forward declaration for mxArray.
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 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.
virtual String getDefaultName() const
FileNode getFirstTopLevelNode() const
const ConstMap< int, std::string > ClassNameInvMap
Translates data type definition used in OpenCV to that of MATLAB.
Global constant definitions.
virtual void compute(InputArray image, std::vector< KeyPoint > &keypoints, OutputArray descriptors)
virtual bool empty() const
virtual void save(const String &filename) const