12 "m00",
"m10",
"m01",
"m20",
"m11",
"m02",
"m30",
"m21",
"m12",
"m03",
13 "mu20",
"mu11",
"mu02",
"mu30",
"mu21",
"mu12",
"mu03",
14 "nu20",
"nu11",
"nu02",
"nu30",
"nu21",
"nu12",
"nu03"};
21 "octave",
"class_id"};
64 if (rhs->
idx[1] < lhs->
idx[1])
66 if (rhs->
idx[1] == lhs->
idx[1] && rhs->
idx[0] < lhs->
idx[0])
87 const char *file_name,
int line,
void * )
94 " File : <a href=\"matlab:opentoline('%s',%d)\">%s</a>\n" 97 (func_name ? func_name :
"(unknown)"),
162 const mwSize nchannels = input.channels();
163 const int* dims_ = input.size;
165 d.push_back(nchannels);
170 input.setTo(1, input);
185 for (
mwIndex i = 0; i < nchannels; ++i) {
186 si[si.size() - 1] = i;
187 void *ptr =
reinterpret_cast<void*
>(
188 reinterpret_cast<size_t>(
mxGetData(p_)) +
248 for (
int i=sz.
size(); i>0; i--)
253 rhs[0] =
const_cast<mxArray*
>(p_);
270 "Not a 2D 1-channel sparse matrix");
291 if (!ir || !jc || !pr)
306 const mwIndex row = nodes[i]->idx[0], col = nodes[i]->idx[1];
310 switch (mat.
depth()) {
312 pr[i] =
static_cast<double>(mat.
value<
uchar>(nodes[i]));
315 pr[i] =
static_cast<double>(mat.
value<
schar>(nodes[i]));
318 pr[i] =
static_cast<double>(mat.
value<
ushort>(nodes[i]));
321 pr[i] =
static_cast<double>(mat.
value<
short>(nodes[i]));
324 pr[i] =
static_cast<double>(mat.
value<
int>(nodes[i]));
327 pr[i] =
static_cast<double>(mat.
value<
float>(nodes[i]));
330 pr[i] = mat.
value<
double>(nodes[i]);
337 for (
mwIndex i = 1; i < n+1; ++i) {
382 set(
"angle", p.
angle);
413 for (
mwIndex i = 0; i <
v.size(); ++i) {
414 set(
"pt",
v[i].pt, i);
415 set(
"size",
v[i].size, i);
416 set(
"angle",
v[i].angle, i);
417 set(
"response",
v[i].response, i);
418 set(
"octave",
v[i].octave, i);
419 set(
"class_id",
v[i].class_id, i);
440 for (
mwIndex i = 0; i <
v.size(); ++i) {
441 set(
"queryIdx",
v[i].queryIdx, i);
442 set(
"trainIdx",
v[i].trainIdx, i);
443 set(
"imgIdx",
v[i].imgIdx, i);
444 set(
"distance",
v[i].distance, i);
455 set(
"angle", r.
angle);
464 for (
mwIndex i = 0; i <
v.size(); ++i) {
465 set(
"center",
v[i].center, i);
466 set(
"size",
v[i].size, i);
467 set(
"angle",
v[i].angle, i);
500 return at<double>(0);
542 const int cn = d.back();
545 return matnd.
reshape(cn, d.size()-1, &d[0]);
562 for (
mwIndex i = 0; i<nchannels; ++i) {
563 si[si.size() - 1] = i;
564 void *pd =
reinterpret_cast<void*
>(
565 reinterpret_cast<size_t>(
mxGetData(p_)) +
615 for (
int i=
ndims(); i>0; i--)
620 rhs[0] =
const_cast<mxArray*
>(p_);
656 "MxArray is not real 2D double sparse");
661 const int dims[] = {
static_cast<int>(m), static_cast<int>(n)};
667 const double *pr =
mxGetPr(p_);
668 if (!ir || !jc || !pr)
672 for (
mwIndex j = 0; j < n; ++j) {
678 switch (mat.
depth()) {
680 mat.
ref<
uchar>(ir[i], j) = static_cast<uchar>(pr[i]);
683 mat.
ref<
schar>(ir[i], j) = static_cast<schar>(pr[i]);
686 mat.
ref<
ushort>(ir[i], j) = static_cast<ushort>(pr[i]);
689 mat.
ref<
short>(ir[i], j) = static_cast<short>(pr[i]);
692 mat.
ref<
int>(ir[i], j) = static_cast<int>(pr[i]);
695 mat.
ref<
float>(ir[i], j) = static_cast<float>(pr[i]);
698 mat.
ref<
double>(ir[i], j) = pr[i];
785 at(
"epsilon",
index).toDouble()
796 "Failed to get field name at %d\n", fieldnumber);
807 for (
mwIndex i = 0; i < n; ++i)
835 "Field '%s' doesn't exist", fieldName.
c_str());
856 mxSetCell(const_cast<mxArray*>(p_),
index, static_cast<mxArray*>(value));
866 for (
mwIndex i = 0; i < n; ++i)
906 std::const_mem_fun_ref_t<cv::Point, MxArray>(
907 &MxArray::toPoint_<int>));
924 std::const_mem_fun_ref_t<cv::Point2f, MxArray>(
925 &MxArray::toPoint_<float>));
942 std::const_mem_fun_ref_t<cv::Point2d, MxArray>(
943 &MxArray::toPoint_<double>));
960 std::const_mem_fun_ref_t<cv::Point3i, MxArray>(
961 &MxArray::toPoint3_<int>));
978 std::const_mem_fun_ref_t<cv::Point3f, MxArray>(
979 &MxArray::toPoint3_<float>));
996 std::const_mem_fun_ref_t<cv::Point3d, MxArray>(
997 &MxArray::toPoint3_<double>));
1048 std::const_mem_fun_ref_t<cv::Vec2i, MxArray>(
1049 &MxArray::toVec<int,2>));
1066 std::const_mem_fun_ref_t<cv::Vec2f, MxArray>(
1067 &MxArray::toVec<float,2>));
1084 std::const_mem_fun_ref_t<cv::Vec3i, MxArray>(
1085 &MxArray::toVec<int,3>));
1102 std::const_mem_fun_ref_t<cv::Vec3f, MxArray>(
1103 &MxArray::toVec<float,3>));
1120 std::const_mem_fun_ref_t<cv::Vec4i, MxArray>(
1121 &MxArray::toVec<int,4>));
1138 std::const_mem_fun_ref_t<cv::Vec4f, MxArray>(
1139 &MxArray::toVec<float,4>));
1150 for (
mwIndex i = 0; i < n; ++i)
1151 v.push_back(at<MxArray>(i).toRotatedRect());
1153 for (
mwIndex i = 0; i < n; ++i)
1157 "MxArray unable to convert to std::vector<cv::RotatedRect>");
1168 for (
mwIndex i = 0; i < n; ++i)
1169 v.push_back(at<MxArray>(i).toKeyPoint());
1171 for (
mwIndex i = 0; i < n; ++i)
1175 "MxArray unable to convert to std::vector<cv::KeyPoint>");
1186 for (
mwIndex i = 0; i < n; ++i)
1187 v.push_back(at<MxArray>(i).toDMatch());
1189 for (
mwIndex i = 0; i < n; ++i)
1193 "MxArray unable to convert to std::vector<cv::DMatch>");
#define mxCalcSingleSubscript
mwSize ndims() const
Number of dimensions.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxChar * mxGetChars(const mxArray *pa)
Get string array data.
int toInt() const
Convert MxArray to int.
std::string fieldname(int fieldnumber) const
Get specified field name from a struct array.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
const char * cvErrorStr(int status)
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxFree(void *ptr)
free memory, notifying registered listener.
virtual float operator()(int varIdx, int sampleIdx)
const char * cv_dmatch_fields[4]
Field names for cv::DMatch.
size_t mwSize
unsigned pointer-width integer
mwSize numel() const
Number of elements in an array.
void split(const Mat &src, Mat *mvbegin)
T at(mwIndex index) const
Template for numeric array element accessor.
cv::TermCriteria toTermCriteria(mwIndex index=0) const
Convert MxArray to cv::TermCriteria.
void convertTo(OutputArray m, int rtype, double alpha=1, double beta=0) const
const ConstMap< std::string, int > TermCritType
TermCriteria type map for option processing.
void copyTo(OutputArray m) const
#define mxCreateLogicalArray
std::string toString() const
Convert MxArray to std::string.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
#define CV_MAKETYPE(depth, cn)
bool isChar() const
Determine whether input is string array.
cv::Size toSize() const
Alias to toSize_<int>.
void transpose(InputArray src, OutputArray dst)
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
cv::DMatch toDMatch(mwIndex index=0) const
Convert MxArray to cv::DMatch.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxDestroyArray(mxArray *pa)
mxArray destructor
bool isDouble() const
Determine whether mxArray represents data as double-precision, floating-point numbers.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
Undetermined class. You cannot specify this category for an mxArray; however, if mxGetClassID cannot ...
bool isContinuous() const
cv::Rect toRect() const
Alias to toRect_<int>.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray * mxCreateLogicalScalar(bool value)
Create a logical scalar mxArray having the specified value.
#define mxCreateStructMatrix
struct mxArray_tag mxArray
Forward declaration for mxArray.
void set(mwIndex index, const T &value)
Template for numeric array element write accessor.
SparseMatIterator begin()
cv::Range toRange() const
Convert MxArray to cv::Range.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetNumberOfElements(const mxArray *pa)
Get number of elements in array.
const ConstMap< int, mxClassID > ClassIDOf
Translates data type definition used in OpenCV to that of MATLAB.
int MexErrorHandler(int status, const char *func_name, const char *err_msg, const char *file_name, int line, void *)
Cutom error callback to be invoked by cv::error(), CV_Assert, etc.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxLogical * mxGetLogicals(const mxArray *pa)
Get a properly typed pointer to the elements of a logical array.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxClassID mxGetClassID(const mxArray *pa)
Return the class (catergory) of data that the array holds.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray * mxCreateDoubleScalar(double value)
Create a double-precision scalar mxArray initialized to the value specified.
std::vector< std::string > fieldnames() const
Get field names of a struct array.
SeqIterator< _Tp > end() const
cv::RotatedRect toRotatedRect(mwIndex index=0) const
Convert MxArray to cv::RotatedRect.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void * mxGetData(const mxArray *pa)
Get pointer to data.
#define mxCreateLogicalMatrix
bool toBool() const
Convert MxArray to bool.
Mat reshape(int cn, int rows=0) const
bool isNumeric() const
Determine whether array is numeric.
bool isComplex() const
Determine whether data is complex.
cv::Point2f toPoint2f() const
Alias to toPoint_<float>.
void line(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
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...
float toFloat() const
Convert MxArray to float.
#define mxCreateNumericMatrix
bool isCell() const
Determine whether input is cell array.
size_t mwIndex
unsigned pointer-width integer
bool isSparse() const
Determine whether input is sparse array.
cv::Point3f toPoint3f() const
Alias to toPoint3_<float>.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C const char * mxGetFieldNameByNumber(const mxArray *pa, int n)
Return pointer to the nth field name.
bool isField(const std::string &fieldName) const
Determine whether a struct array has a specified field.
const char * cv_term_criteria_fields[3]
Field names for cv::TermCriteria.
mxArray object wrapper for data conversion and manipulation.
cv::SparseMat toSparseMat(int depth=CV_USRTYPE1) const
Convert double sparse MxArray to 2D single-channel cv::SparseMat.
bool isStruct() const
Determine whether input is structure array.
mxClassID
Enumeration corresponding to all the valid mxArray types.
#define mxCreateNumericArray
const ConstMap< mxClassID, int > DepthOf
Translates data type definition used in MATLAB to that of OpenCV.
cv::KeyPoint toKeyPoint(mwIndex index=0) const
Convert MxArray to cv::KeyPoint.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
#define mxCreateCharArray
std::vector< T > toVector() const
Convert MxArray to std::vector<T> of primitive types.
const char * cv_keypoint_fields[6]
Field names for cv::KeyPoint.
cv::MatND toMatND(int depth=CV_USRTYPE1, bool transpose=true) const
Convert MxArray to a single-channel cv::Mat.
Identifies a logical mxArray, an mxArray of mxLogical data.
void compare(InputArray src1, InputArray src2, OutputArray dst, int cmpop)
void merge(const Mat *mv, size_t count, OutputArray dst)
int nfields() const
Number of fields in a struct array.
bool isLogical() const
Determine whether array is of type mxLogical.
const ConstMap< int, std::string > InvTermCritType
Inverse TermCriteria type map for option processing.
Comparison operator for sparse matrix elements.
cv::Mat toMat(int depth=CV_USRTYPE1, bool transpose=true) const
Convert MxArray to cv::Mat.
#define CV_DbgAssert(expr)
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
Mat & setTo(InputArray value, InputArray mask=noArray())
mwSize rows() const
Number of rows in an array.
mwSize cols() const
Number of columns in an array.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetElementSize(const mxArray *pa)
Get array data element size.
mwIndex subs(mwIndex i, mwIndex j=0) const
Offset from first element to desired element.
double toDouble() const
Convert MxArray to double.
const mwSize * dims() const
Array of each dimension.
MxArray(const mxArray *arr)
MxArray constructor from mxArray*.
cv::Point toPoint() const
Alias to toPoint_<int>.
Identifies a numeric mxArray whose data is stored as the type specified in the MATLAB Primitive Types...
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray * mxCreateString(const char *str)
Create a 1-by-n string array initialized to NULL terminated string where n is the length of the strin...
const char * cv_rotated_rect_fields[3]
Field names for cv::RotatedRect.
cv::Moments toMoments(mwIndex index=0) const
Convert MxArray to cv::Moments.
const char * cv_moments_fields[24]
Field names for cv::Moments.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C char * mxArrayToString(const mxArray *pa)
Create a NULL terminated C-string from an mxArray of type mxCHAR_CLASS Supports multibyte character s...
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray * mxDuplicateArray(const mxArray *pa)
Make a deep copy of an array, return a pointer to the copy.
bool isNull() const
Determine whether the array is initialized or not.
std::map wrapper with one-line initialization and lookup method.
MxArray clone() const
Clone mxArray.
mxClassID classID() const
Class ID of mxArray.
LIBMWMEX_API_EXTERN_C int mexCallMATLAB(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[], const char *fcn_name)
call MATLAB function
_Tp & ref(int i0, size_t *hashval=0)
MxArray & operator=(const MxArray &rhs)
Assignment operator.
Identifies an mxArray with no imaginary components.
LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double * mxGetPr(const mxArray *pa)
Get real data pointer for numeric array.