25 "response",
"octave",
"class_id",
"axes",
"si",
"transf"};
46 s.
set(
"pt", kpts[i].pt, i);
48 s.
set(
"angle", kpts[i].angle, i);
49 s.
set(
"response", kpts[i].response, i);
50 s.
set(
"octave", kpts[i].octave, i);
51 s.
set(
"class_id", kpts[i].class_id, i);
52 s.
set(
"axes", kpts[i].axes, i);
53 s.
set(
"si", kpts[i].si, i);
54 s.
set(
"transf", kpts[i].transf, i);
62 kpt.
pt = arr.
at(
"pt", idx).toPoint2f();
63 kpt.
size = arr.
at(
"size", idx).toFloat();
64 kpt.
angle = arr.
isField(
"angle") ? arr.
at(
"angle", idx).toFloat() : -1;
68 kpt.
axes = arr.
at(
"axes", idx).toSize_<
float>();
69 kpt.
si = arr.
at(
"si", idx).toFloat();
70 kpt.
transf = arr.
at(
"transf", idx).toMatx<float,2,3>();
87 "MxArray unable to convert to vector<Elliptic_KeyPoint>");
106 int id = rhs[0].toInt();
107 string method(rhs[1].toString());
110 if (method ==
"new") {
111 nargchk((nrhs==3 || nrhs==4) && nlhs<=1);
116 rhs[2].toString(), rhs.
end(), rhs.
end());
117 else if (rhs[2].isCell() && rhs[2].numel() >= 1) {
120 args[0].toString(), args.
begin() + 1, args.
end());
124 "Invalid detector arguments");
130 rhs[3].toString(), rhs.
end(), rhs.
end());
131 else if (rhs[3].isCell() && rhs[3].numel() >= 1) {
134 args[0].toString(), args.
begin() + 1, args.
end());
138 "Invalid extractor arguments");
151 if (method ==
"delete") {
156 else if (method ==
"typeid") {
158 plhs[0] =
MxArray(
string(
typeid(*obj).name()));
160 else if (method ==
"clear") {
164 else if (method ==
"load") {
165 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs==0);
167 bool loadFromString =
false;
168 for (
int i=3; i<nrhs; i+=2) {
169 string key(rhs[i].toString());
170 if (key ==
"ObjName")
171 objname = rhs[i+1].toString();
172 else if (key ==
"FromString")
173 loadFromString = rhs[i+1].toBool();
176 "Unrecognized option %s", key.
c_str());
185 FileStorage fs(rhs[2].toString(), FileStorage::READ +
186 (loadFromString ? FileStorage::MEMORY : 0));
195 else if (method ==
"save") {
197 obj->
save(rhs[2].toString());
199 else if (method ==
"empty") {
203 else if (method ==
"getDefaultName") {
207 else if (method ==
"defaultNorm") {
211 else if (method ==
"descriptorSize") {
215 else if (method ==
"descriptorType") {
219 else if (method ==
"detect") {
220 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
221 if (rhs[2].isNumeric()) {
223 for (
int i=3; i<nrhs; i+=2) {
224 string key(rhs[i].toString());
226 mask = rhs[i+1].toMat(
CV_8U);
229 "Unrecognized option %s", key.
c_str());
233 obj->
detect(image, keypoints, mask);
236 else if (rhs[2].isCell()) {
238 for (
int i=3; i<nrhs; i+=2) {
239 string key(rhs[i].toString());
250 "Unrecognized option %s", key.
c_str());
261 obj->
detect(images, keypoints, masks);
267 else if (method ==
"compute") {
269 if (rhs[2].isNumeric()) {
272 obj->
compute(image, keypoints, descriptors);
273 plhs[0] =
MxArray(descriptors);
277 else if (rhs[2].isCell()) {
288 &MxArray::toVector<KeyPoint>)));
289 obj->
compute(images, keypoints, descriptors);
290 plhs[0] =
MxArray(descriptors);
297 else if (method ==
"detectAndCompute") {
298 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=2);
301 bool useProvidedKeypoints =
false;
302 for (
int i=3; i<nrhs; i+=2) {
303 string key(rhs[i].toString());
305 mask = rhs[i+1].toMat(
CV_8U);
306 else if (key ==
"Keypoints") {
307 keypoints = rhs[i+1].toVector<
KeyPoint>();
308 useProvidedKeypoints =
true;
312 "Unrecognized option %s", key.
c_str());
316 useProvidedKeypoints);
319 plhs[1] =
MxArray(descriptors);
321 else if (method ==
"detect_elliptic") {
322 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=1);
324 for (
int i=3; i<nrhs; i+=2) {
325 string key(rhs[i].toString());
327 mask = rhs[i+1].toMat(
CV_8U);
330 "Unrecognized option %s", key.
c_str());
334 obj->
detect(image, keypoints, mask);
337 else if (method ==
"detectAndCompute_elliptic") {
338 nargchk(nrhs>=3 && (nrhs%2)==1 && nlhs<=2);
341 bool useProvidedKeypoints =
false;
342 for (
int i=3; i<nrhs; i+=2) {
343 string key(rhs[i].toString());
345 mask = rhs[i+1].toMat(
CV_8U);
346 else if (key ==
"Keypoints") {
348 useProvidedKeypoints =
true;
352 "Unrecognized option %s", key.
c_str());
356 useProvidedKeypoints);
359 plhs[1] =
MxArray(descriptors);
363 "Unrecognized operation %s",method.
c_str());
virtual int descriptorType() const
mwSize numel() const
Number of elements in an array.
T at(mwIndex index) const
Template for numeric array element accessor.
LIBMWMEX_API_EXTERN_C void mexLock(void)
Lock a MEX-function so that it cannot be cleared from memory.
int last_id
Last object id to allocate.
MxArray toStruct(const vector< Elliptic_KeyPoint > &kpts)
vector< Elliptic_KeyPoint > MxArrayToVectorEllipticKeyPoint(const MxArray &arr)
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.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
Elliptic_KeyPoint MxArrayToEllipticKeyPoint(const MxArray &arr, mwIndex idx)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
virtual int defaultNorm() const
cv::Ptr< cv::FeatureDetector > createFeatureDetector(const std::string &type, std::vector< MxArray >::const_iterator first, std::vector< MxArray >::const_iterator last)
Factory function for FeatureDetector creation.
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...
bool isCell() const
Determine whether input is cell array.
LIBMWMEX_API_EXTERN_C void mexUnlock(void)
Unlock a locked MEX-function so that it can be cleared from memory.
virtual int descriptorSize() const
bool isField(const std::string &fieldName) const
Determine whether a struct array has a specified field.
virtual void detect(InputArray image, std::vector< Elliptic_KeyPoint > &keypoints, InputArray mask=noArray())=0
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.
static MxArray Struct(const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1)
Create a new struct array.
const char * cv_elliptic_keypoint_fields[9]
Field names for cv::xfeatures2d::Elliptic_KeyPoint.
virtual String getDefaultName() const
FileNode getFirstTopLevelNode() const
bool isStruct() const
Determine whether input is structure array.
virtual void detectAndCompute(InputArray image, InputArray mask, std::vector< Elliptic_KeyPoint > &keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)=0
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
map< int, Ptr< AffineFeature2D > > obj_
Object container.
virtual void save(const String &filename) const
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)