37 int id = rhs[0].toInt();
38 string method(rhs[1].toString());
41 if (method ==
"new") {
47 rhs[2].toString(), rhs.
end(), rhs.
end());
48 else if (rhs[2].isCell() && rhs[2].numel() >= 2) {
51 args[0].toString(), args.
begin() + 1, args.
end());
55 "Invalid extractor arguments");
60 rhs[3].toString(), rhs.
end(), rhs.
end());
61 else if (rhs[3].isCell() && rhs[3].numel() >= 2) {
64 args[0].toString(), args.
begin() + 1, args.
end());
68 obj_[++
last_id] = makePtr<BOWImgDescriptorExtractor>(
79 if (method ==
"delete") {
84 else if (method ==
"descriptorSize") {
88 else if (method ==
"descriptorType") {
92 else if (method ==
"compute") {
95 imgDescriptor, descriptors;
98 obj->
compute(image, keypoints, imgDescriptor,
99 (nlhs>1 ? &pointIdxsOfClusters : NULL),
100 (nlhs>2 ? &descriptors : NULL));
101 plhs[0] =
MxArray(imgDescriptor);
103 plhs[1] =
MxArray(pointIdxsOfClusters);
105 plhs[2] =
MxArray(descriptors);
107 else if (method ==
"compute1") {
112 obj->
compute(keypointDescriptors, imgDescriptor,
113 (nlhs>1 ? &pointIdxsOfClusters : NULL));
114 plhs[0] =
MxArray(imgDescriptor);
116 plhs[1] =
MxArray(pointIdxsOfClusters);
118 else if (method ==
"compute2") {
123 obj->
compute2(image, keypoints, imgDescriptor);
124 plhs[0] =
MxArray(imgDescriptor);
126 else if (method ==
"get") {
128 string prop(rhs[2].toString());
129 if (prop ==
"Vocabulary")
133 "Unrecognized property %s", prop.
c_str());
135 else if (method ==
"set") {
137 string prop(rhs[2].toString());
138 if (prop ==
"Vocabulary")
142 "Unrecognized property %s", prop.
c_str());
146 "Unrecognized operation %s", method.
c_str());
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.
struct mxArray_tag mxArray
Forward declaration for mxArray.
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.
cv::Ptr< cv::DescriptorMatcher > createDescriptorMatcher(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Factory function for DescriptorMatcher creation.
const ConstMap< int, std::string > ClassNameInvMap
Translates data type definition used in OpenCV to that of MATLAB.
Global constant definitions.