mexopencv  3.4.1
MEX interface for OpenCV library
AGAST.cpp
Go to the documentation of this file.
1 
8 #include "mexopencv.hpp"
9 #include "opencv2/features2d.hpp"
10 using namespace std;
11 using namespace cv;
12 
13 namespace {
20 }
21 
29 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
30 {
31  // Check the number of arguments
32  nargchk(nrhs>=1 && (nrhs%2)==1 && nlhs<=1);
33 
34  // Argument vector
35  vector<MxArray> rhs(prhs, prhs+nrhs);
36 
37  // Option processing
38  int threshold = 10;
39  bool nonmaxSupression = true;
41  for (int i=1; i<nrhs; i+=2) {
42  string key(rhs[i].toString());
43  if (key == "Threshold")
44  threshold = rhs[i+1].toInt();
45  else if (key == "NonmaxSuppression")
46  nonmaxSupression = rhs[i+1].toBool();
47  else if (key == "Type")
48  type = AgastTypeMap[rhs[i+1].toString()];
49  else
50  mexErrMsgIdAndTxt("mexopencv:error",
51  "Unrecognized option %s", key.c_str());
52  }
53 
54  // Process
55  Mat image(rhs[0].toMat(CV_8U));
56  vector<KeyPoint> keypoints;
57  AGAST(image, keypoints, threshold, nonmaxSupression, type);
58  plhs[0] = MxArray(keypoints);
59 }
const ConstMap< std::string, int > AgastTypeMap
AGAST neighborhood types.
#define CV_8U
STL namespace.
struct mxArray_tag mxArray
Forward declaration for mxArray.
Definition: matrix.h:259
void AGAST(InputArray image, std::vector< KeyPoint > &keypoints, int threshold, bool nonmaxSuppression=true)
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...
mxArray object wrapper for data conversion and manipulation.
Definition: MxArray.hpp:123
void nargchk(bool cond)
Alias for input/output arguments number check.
Definition: mexopencv.hpp:181
STL class.
Global constant definitions.
T c_str(T... args)
double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Definition: AGAST.cpp:29
int type() const
std::map wrapper with one-line initialization and lookup method.
Definition: MxArray.hpp:927
cv::Mat toMat() const