23 arr.
set(0, static_cast<uint64_t>(i));
42 string method(rhs[0].toString());
45 if (method ==
"removeDuplicated") {
48 KeyPointsFilter::removeDuplicated(keypoints);
51 else if (method ==
"removeDuplicatedSorted") {
54 KeyPointsFilter::removeDuplicatedSorted(keypoints);
57 else if (method ==
"retainBest") {
60 int npoints = rhs[2].toInt();
61 KeyPointsFilter::retainBest(keypoints, npoints);
64 else if (method ==
"runByImageBorder") {
67 Size imageSize(rhs[2].toSize());
68 int borderSize = rhs[3].toInt();
69 KeyPointsFilter::runByImageBorder(keypoints, imageSize, borderSize);
72 else if (method ==
"runByKeypointSize") {
73 nargchk((nrhs==3 || nrhs==4) && nlhs<=1);
75 float minSize = rhs[2].toFloat();
76 float maxSize = (nrhs==4) ? rhs[3].toFloat() : FLT_MAX;
77 KeyPointsFilter::runByKeypointSize(keypoints, minSize, maxSize);
80 else if (method ==
"runByPixelsMask") {
84 KeyPointsFilter::runByPixelsMask(keypoints, mask);
87 else if (method ==
"convertToPoints") {
88 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
90 for (
int i=2; i<nrhs; i+=2) {
91 string key(rhs[i].toString());
93 keypointIndexes = rhs[i+1].toVector<
int>();
96 "Unrecognized option %s", key.
c_str());
100 KeyPoint::convert(keypoints, points2f, keypointIndexes);
103 else if (method ==
"convertFromPoints") {
104 nargchk(nrhs>=2 && (nrhs%2)==0 && nlhs<=1);
106 float response = 1.0f;
109 for (
int i=2; i<nrhs; i+=2) {
110 string key(rhs[i].toString());
112 size = rhs[i+1].toFloat();
113 else if (key ==
"Response")
114 response = rhs[i+1].toFloat();
115 else if (key ==
"Octave")
116 octave = rhs[i+1].toInt();
117 else if (key ==
"ClassId")
118 class_id = rhs[i+1].toInt();
121 "Unrecognized option %s", key.
c_str());
125 KeyPoint::convert(points2f, keypoints,
126 size, response, octave, class_id);
129 else if (method ==
"overlap") {
132 kp2 = rhs[2].toKeyPoint();
133 float ovrl = KeyPoint::overlap(kp1, kp2);
136 else if (method ==
"hash") {
139 size_t val = kp.
hash();
144 "Unrecognized operation %s", method.
c_str());
MxArray toMxArray(size_t i)
Convert size type to MxArray.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
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...
#define mxCreateNumericMatrix
mxArray object wrapper for data conversion and manipulation.
void nargchk(bool cond)
Alias for input/output arguments number check.
Global constant definitions.
bool isNull() const
Determine whether the array is initialized or not.
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
Main entry called from Matlab.
Identifies an mxArray with no imaginary components.