mexopencv
0.1
mex interface for opencv library
|
mxArray object wrapper for data conversion and manipulation. More...
#include <MxArray.hpp>
Public Member Functions | |
MxArray (const mxArray *arr) | |
MxArray constructor from mxArray*. More... | |
MxArray (const MxArray &arr) | |
Copy constructor. More... | |
MxArray & | operator= (const MxArray &rhs) |
Assignment operator. More... | |
MxArray (const int i) | |
MxArray constructor from int. More... | |
MxArray (const double d) | |
MxArray constructor from double. More... | |
MxArray (const bool b) | |
MxArray constructor from bool. More... | |
MxArray (const std::string &s) | |
MxArray constructor from std::string. More... | |
MxArray (const cv::Mat &mat, mxClassID classid=mxUNKNOWN_CLASS, bool transpose=true) | |
Convert cv::Mat to MxArray. More... | |
MxArray (const cv::SparseMat &mat) | |
Convert float cv::SparseMat to MxArray. More... | |
MxArray (const cv::Moments &m) | |
Convert cv::Moments to MxArray. More... | |
MxArray (const cv::KeyPoint &p) | |
Convert cv::KeyPoint to MxArray. More... | |
MxArray (const cv::DMatch &m) | |
Convert cv::DMatch to MxArray. More... | |
MxArray (const cv::RotatedRect &r) | |
Convert cv::RotatedRect to MxArray. More... | |
MxArray (const cv::TermCriteria &t) | |
Convert cv::TermCriteria to MxArray. More... | |
template<typename T > | |
MxArray (const std::vector< T > &v) | |
MxArray constructor from vector<T>. More... | |
template<typename T > | |
MxArray (const cv::Point_< T > &p) | |
MxArray constructor from cv::Point_<T>. More... | |
template<typename T > | |
MxArray (const cv::Point3_< T > &p) | |
MxArray constructor from cv::Point3_<T>. More... | |
template<typename T > | |
MxArray (const cv::Size_< T > &s) | |
MxArray constructor from cv::Size_<T>. More... | |
template<typename T > | |
MxArray (const cv::Rect_< T > &r) | |
MxArray constructor from cv::Rect_<T>. More... | |
template<typename T > | |
MxArray (const cv::Scalar_< T > &s) | |
MxArray constructor from cv::Scalar_<T>. More... | |
template<typename T , int cn> | |
MxArray (const cv::Vec< T, cn > &vec) | |
MxArray constructor from cv::Vec<T,cn>. More... | |
template<typename T , int m, int n> | |
MxArray (const cv::Matx< T, m, n > &mat) | |
MxArray constructor from cv::Matx<T,m,n>. More... | |
virtual | ~MxArray () |
Destructor. More... | |
MxArray | clone () const |
Clone mxArray. More... | |
void | destroy () |
Deallocate memory occupied by mxArray. More... | |
operator const mxArray * () const | |
Implicit conversion to const mxArray*. More... | |
operator mxArray * () const | |
Implicit conversion to mxArray*. More... | |
int | toInt () const |
Convert MxArray to int. More... | |
double | toDouble () const |
Convert MxArray to double. More... | |
float | toFloat () const |
Convert MxArray to float. More... | |
bool | toBool () const |
Convert MxArray to bool. More... | |
std::string | toString () const |
Convert MxArray to std::string. More... | |
cv::Mat | toMat (int depth=CV_USRTYPE1, bool transpose=true) const |
Convert MxArray to cv::Mat. More... | |
cv::MatND | toMatND (int depth=CV_USRTYPE1, bool transpose=true) const |
Convert MxArray to a single-channel cv::Mat. More... | |
cv::SparseMat | toSparseMat (int depth=CV_USRTYPE1) const |
Convert double sparse MxArray to 2D single-channel cv::SparseMat. More... | |
cv::Moments | toMoments (mwIndex index=0) const |
Convert MxArray to cv::Moments. More... | |
cv::KeyPoint | toKeyPoint (mwIndex index=0) const |
Convert MxArray to cv::KeyPoint. More... | |
cv::DMatch | toDMatch (mwIndex index=0) const |
Convert MxArray to cv::DMatch. More... | |
cv::Range | toRange () const |
Convert MxArray to cv::Range. More... | |
cv::RotatedRect | toRotatedRect (mwIndex index=0) const |
Convert MxArray to cv::RotatedRect. More... | |
cv::TermCriteria | toTermCriteria (mwIndex index=0) const |
Convert MxArray to cv::TermCriteria. More... | |
template<typename T > | |
cv::Point_< T > | toPoint_ () const |
Convert MxArray to Point_<T>. More... | |
template<typename T > | |
cv::Point3_< T > | toPoint3_ () const |
Convert MxArray to Point3_<T>. More... | |
template<typename T > | |
cv::Size_< T > | toSize_ () const |
Convert MxArray to Size_<T>. More... | |
template<typename T > | |
cv::Rect_< T > | toRect_ () const |
Convert MxArray to Rect_<T>. More... | |
template<typename T > | |
cv::Scalar_< T > | toScalar_ () const |
Convert MxArray to Scalar_<T>. More... | |
template<typename T , int cn> | |
cv::Vec< T, cn > | toVec () const |
Convert MxArray to Vec<T,cn>. More... | |
template<typename T , int m, int n> | |
cv::Matx< T, m, n > | toMatx () const |
Convert MxArray to Matx<T,m,n>. More... | |
template<typename T > | |
std::vector< T > | toVector () const |
Convert MxArray to std::vector<T> of primitive types. More... | |
template<typename T > | |
std::vector< T > | toVector (std::const_mem_fun_ref_t< T, MxArray > f) const |
Convert MxArray to std::vector<T> by a specified conversion method. More... | |
cv::Point | toPoint () const |
Alias to toPoint_<int>. More... | |
cv::Point2f | toPoint2f () const |
Alias to toPoint_<float>. More... | |
cv::Point3f | toPoint3f () const |
Alias to toPoint3_<float>. More... | |
cv::Size | toSize () const |
Alias to toSize_<int>. More... | |
cv::Rect | toRect () const |
Alias to toRect_<int>. More... | |
cv::Scalar | toScalar () const |
Alias to toScalar_<double> More... | |
mxClassID | classID () const |
Class ID of mxArray. More... | |
const std::string | className () const |
Class name of mxArray. More... | |
mwSize | numel () const |
Number of elements in an array. More... | |
mwSize | ndims () const |
Number of dimensions. More... | |
const mwSize * | dims () const |
Array of each dimension. More... | |
mwSize | rows () const |
Number of rows in an array. More... | |
mwSize | cols () const |
Number of columns in an array. More... | |
int | nfields () const |
Number of fields in a struct array. More... | |
std::string | fieldname (int fieldnumber) const |
Get specified field name from a struct array. More... | |
std::vector< std::string > | fieldnames () const |
Get field names of a struct array. More... | |
mwSize | nzmax () const |
Number of elements in IR , PR , and PI arrays. More... | |
mwIndex | subs (mwIndex i, mwIndex j=0) const |
Offset from first element to desired element. More... | |
mwIndex | subs (const std::vector< mwIndex > &si) const |
Offset from first element to desired element. More... | |
bool | isNull () const |
Determine whether the array is initialized or not. More... | |
bool | isCell () const |
Determine whether input is cell array. More... | |
bool | isChar () const |
Determine whether input is string array. More... | |
bool | isClass (std::string s) const |
Determine whether array is member of specified class. More... | |
bool | isComplex () const |
Determine whether data is complex. More... | |
bool | isDouble () const |
Determine whether mxArray represents data as double-precision, floating-point numbers. More... | |
bool | isEmpty () const |
Determine whether array is empty. More... | |
bool | isFromGlobalWS () const |
Determine whether array was copied from MATLAB global workspace. More... | |
bool | isInt8 () const |
Determine whether array represents data as signed 8-bit integers. More... | |
bool | isInt16 () const |
Determine whether array represents data as signed 16-bit integers. More... | |
bool | isInt32 () const |
Determine whether array represents data as signed 32-bit integers. More... | |
bool | isInt64 () const |
Determine whether array represents data as signed 64-bit integers. More... | |
bool | isLogical () const |
Determine whether array is of type mxLogical. More... | |
bool | isLogicalScalar () const |
Determine whether scalar array is of type mxLogical. More... | |
bool | isLogicalScalarTrue () const |
Determine whether scalar array of type mxLogical is true. More... | |
bool | isNumeric () const |
Determine whether array is numeric. More... | |
bool | isSingle () const |
Determine whether array represents data as single-precision, floating-point numbers. More... | |
bool | isSparse () const |
Determine whether input is sparse array. More... | |
bool | isStruct () const |
Determine whether input is structure array. More... | |
bool | isUint8 () const |
Determine whether array represents data as unsigned 8-bit integers. More... | |
bool | isUint16 () const |
Determine whether array represents data as unsigned 16-bit integers. More... | |
bool | isUint32 () const |
Determine whether array represents data as unsigned 32-bit integers. More... | |
bool | isUint64 () const |
Determine whether array represents data as unsigned 64-bit integers. More... | |
bool | isInteger () const |
Determine whether array represents data as integer types (8-bit, 16-bit, 32-bit or 64-bit, both signed and unsigned). More... | |
bool | isFloat () const |
Determine whether array represents data as floating-point numbers, both single and double precision. More... | |
bool | isField (const std::string &fieldName) const |
Determine whether a struct array has a specified field. More... | |
template<typename T > | |
T | at (mwIndex index) const |
Template for numeric array element accessor. More... | |
template<typename T > | |
T | at (mwIndex i, mwIndex j) const |
Template for numeric array element accessor. More... | |
template<typename T > | |
T | at (const std::vector< mwIndex > &si) const |
Template for numeric array element accessor. More... | |
MxArray | at (const std::string &fieldName, mwIndex index=0) const |
Struct array element accessor. More... | |
template<typename T > | |
void | set (mwIndex index, const T &value) |
Template for numeric array element write accessor. More... | |
template<typename T > | |
void | set (mwIndex i, mwIndex j, const T &value) |
Template for numeric array element write accessor. More... | |
template<typename T > | |
void | set (const std::vector< mwIndex > &si, const T &value) |
Template for numeric array element write accessor. More... | |
template<typename T > | |
void | set (const std::string &fieldName, const T &value, mwIndex index=0) |
Template for struct array element write accessor. More... | |
template<> | |
void | fromVector (const std::vector< char > &v) |
MxArray specialized constructor from vector<char>. More... | |
template<> | |
void | fromVector (const std::vector< bool > &v) |
MxArray specialized constructor from vector<bool>. More... | |
template<> | |
MxArray (const std::vector< cv::DMatch > &v) | |
MxArray specialized constructor from vector<DMatch>. More... | |
template<> | |
MxArray (const std::vector< cv::KeyPoint > &v) | |
MxArray specialized constructor from vector<KeyPoint>. More... | |
template<> | |
MxArray (const std::vector< cv::RotatedRect > &v) | |
MxArray specialized constructor from vector<RotatedRect>. More... | |
template<> | |
MxArray | at (mwIndex index) const |
Cell array element accessor. More... | |
template<> | |
void | set (mwIndex index, const MxArray &value) |
Cell array element write accessor. More... | |
template<> | |
std::vector< MxArray > | toVector () const |
Convert MxArray to std::vector<MxArray>. More... | |
template<> | |
std::vector< std::string > | toVector () const |
Convert MxArray to std::vector<std::string>. More... | |
template<> | |
std::vector< cv::Mat > | toVector () const |
Convert MxArray to std::vector<cv::Mat>. More... | |
template<> | |
std::vector< cv::Point > | toVector () const |
Convert MxArray to std::vector<Point>. More... | |
template<> | |
std::vector< cv::Point2f > | toVector () const |
Convert MxArray to std::vector<Point2f>. More... | |
template<> | |
std::vector< cv::Point2d > | toVector () const |
Convert MxArray to std::vector<Point2d>. More... | |
template<> | |
std::vector< cv::Point3i > | toVector () const |
Convert MxArray to std::vector<Point3i>. More... | |
template<> | |
std::vector< cv::Point3f > | toVector () const |
Convert MxArray to std::vector<Point3f>. More... | |
template<> | |
std::vector< cv::Point3d > | toVector () const |
Convert MxArray to std::vector<Point3d>. More... | |
template<> | |
std::vector< cv::Size > | toVector () const |
Convert MxArray to std::vector<Size>. More... | |
template<> | |
std::vector< cv::Rect > | toVector () const |
Convert MxArray to std::vector<Rect>. More... | |
template<> | |
std::vector< cv::Vec2i > | toVector () const |
Convert MxArray to std::vector<Vec2i>. More... | |
template<> | |
std::vector< cv::Vec2f > | toVector () const |
Convert MxArray to std::vector<Vec2f>. More... | |
template<> | |
std::vector< cv::Vec3i > | toVector () const |
Convert MxArray to std::vector<Vec3i>. More... | |
template<> | |
std::vector< cv::Vec3f > | toVector () const |
Convert MxArray to std::vector<Vec3f>. More... | |
template<> | |
std::vector< cv::Vec4i > | toVector () const |
Convert MxArray to std::vector<Vec4i>. More... | |
template<> | |
std::vector< cv::Vec4f > | toVector () const |
Convert MxArray to std::vector<Vec4f>. More... | |
template<> | |
std::vector< cv::RotatedRect > | toVector () const |
Convert MxArray to std::vector<cv::RotatedRect>. More... | |
template<> | |
std::vector< cv::KeyPoint > | toVector () const |
Convert MxArray to std::vector<cv::KeyPoint>. More... | |
template<> | |
std::vector< cv::DMatch > | toVector () const |
Convert MxArray to std::vector<cv::DMatch>. More... | |
Static Public Member Functions | |
static MxArray | Cell (mwSize m=1, mwSize n=1) |
Create a new cell array. More... | |
static MxArray | Struct (const char **fields=NULL, int nfields=0, mwSize m=1, mwSize n=1) |
Create a new struct array. More... | |
static bool | isFinite (double d) |
Determine whether input is finite. More... | |
static bool | isInf (double d) |
Determine whether input is infinite. More... | |
static bool | isNaN (double d) |
Determine whether input is NaN (Not-a-Number). More... | |
static double | Inf () |
Value of infinity. More... | |
static double | NaN () |
Value of NaN (Not-a-Number). More... | |
static double | Eps () |
Value of EPS . More... | |
mxArray object wrapper for data conversion and manipulation.
Definition at line 123 of file MxArray.hpp.
|
inline |
MxArray constructor from mxArray*.
arr | mxArray pointer given by mexFunction. |
Definition at line 129 of file MxArray.hpp.
|
inline |
|
explicit |
MxArray constructor from int.
i | int value. |
Definition at line 109 of file MxArray.cpp.
|
explicit |
MxArray constructor from double.
d | double value. |
Definition at line 116 of file MxArray.cpp.
|
explicit |
MxArray constructor from bool.
b | bool value. |
Definition at line 123 of file MxArray.cpp.
|
explicit |
MxArray constructor from std::string.
s | reference to a string value. |
Definition at line 130 of file MxArray.cpp.
|
explicit |
Convert cv::Mat to MxArray.
mat | cv::Mat object. |
classid | classid of mxArray. e.g., mxDOUBLE_CLASS . When mxUNKNOWN_CLASS is specified, classid will be automatically determined from the type of cv::Mat. default: mxUNKNOWN_CLASS . |
transpose | Optional transposition to the return value so that rows and columns of the 2D Mat are mapped to the 2nd and 1st dimensions in MxArray, respectively. This does not apply the N-D array conversion. default true. |
Convert cv::Mat object to an MxArray. When the cv::Mat object is 2D, the width, height, and channels are mapped to the first, second, and third dimensions of the MxArray unless transpose
flag is set to false. When the cv::Mat object is N-D, (dim 1, dim 2,...dim N, channels)
are mapped to (dim 2, dim 1, ..., dim N, dim N+1)
, respectively.
Example:
Definition at line 196 of file MxArray.cpp.
|
explicit |
Convert float cv::SparseMat to MxArray.
mat | cv::SparseMat object. |
Definition at line 265 of file MxArray.cpp.
|
explicit |
Convert cv::Moments to MxArray.
m | cv::Moments object. |
Definition at line 344 of file MxArray.cpp.
|
explicit |
Convert cv::KeyPoint to MxArray.
p | cv::KeyPoint object. |
Definition at line 375 of file MxArray.cpp.
|
explicit |
Convert cv::DMatch to MxArray.
m | cv::DMatch object. |
Definition at line 423 of file MxArray.cpp.
|
explicit |
Convert cv::RotatedRect to MxArray.
r | cv::RotatedRect object. |
Definition at line 448 of file MxArray.cpp.
|
explicit |
Convert cv::TermCriteria to MxArray.
t | cv::TermCriteria object. |
Definition at line 471 of file MxArray.cpp.
|
inlineexplicit |
MxArray constructor from vector<T>.
v | vector of type T. |
The constructor forwards the call to an appropriate overloaded method according to the paramter type (tag dispatching by instance). In the general case, vectors of primitive types are converted to numeric arrays of the equivalent MATLAB type, while other types are converted to cell arrays.
Example:
Definition at line 231 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Point_<T>.
p | cv::Point_<T> object. |
[x, y]
. Definition at line 974 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Point3_<T>.
p | cv::Point3_<T> object. |
[x, y, z]
. Definition at line 985 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Size_<T>.
s | cv::Size_<T> object. |
Definition at line 997 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Rect_<T>.
r | cv::Rect_<T> object. |
[x, y, width, height]
. Definition at line 1008 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Scalar_<T>.
s | cv::Scalar_<T> object. |
[v0, v1, v2, v3]
. Definition at line 1021 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Vec<T,cn>.
vec | cv::Vec<T,cn> object. |
cn
-element numeric MxArray [v0, v1, ...]
. Definition at line 1034 of file MxArray.hpp.
|
explicit |
MxArray constructor from cv::Matx<T,m,n>.
mat | cv::Mat<T,m,n> object. |
m-by-n
numeric MxArray matrix [mat_11, ..., mat_1n; ....; mat_m1, ..., mat_mn]
. Definition at line 1049 of file MxArray.hpp.
|
inlinevirtual |
MxArray::MxArray | ( | const std::vector< cv::DMatch > & | v | ) |
MxArray specialized constructor from vector<DMatch>.
v | vector of type DMatch. |
Definition at line 435 of file MxArray.cpp.
MxArray::MxArray | ( | const std::vector< cv::KeyPoint > & | v | ) |
MxArray specialized constructor from vector<KeyPoint>.
v | vector of type KeyPoint. |
Definition at line 408 of file MxArray.cpp.
MxArray::MxArray | ( | const std::vector< cv::RotatedRect > & | v | ) |
MxArray specialized constructor from vector<RotatedRect>.
v | vector of type RotatedRect. |
Definition at line 459 of file MxArray.cpp.
T MxArray::at | ( | mwIndex | index | ) | const |
Template for numeric array element accessor.
index | linear index of the array element. |
This getter method is intended for accessing elements of primitive types of a numeric array. Use an appropriate specialized/overloaded method version for accessing elements of struct or cell arrays.
In MATLAB, this is equivalent to getting:
Example:
Definition at line 1250 of file MxArray.hpp.
T MxArray::at | ( | mwIndex | i, |
mwIndex | j | ||
) | const |
Template for numeric array element accessor.
i | index of the first dimension. |
j | index of the second dimension. |
This getter method is intended for accessing elements of primitive types of a numeric array.
In MATLAB, this is equivalent to getting:
Definition at line 1298 of file MxArray.hpp.
T MxArray::at | ( | const std::vector< mwIndex > & | si | ) | const |
Template for numeric array element accessor.
si | vector of subscripts for each dimension of the array. |
This getter method is intended for accessing elements of primitive types of a numeric array.
In MATLAB, this is equivalent to getting:
Definition at line 1304 of file MxArray.hpp.
MxArray MxArray::at | ( | const std::string & | fieldName, |
mwIndex | index = 0 |
||
) | const |
Struct array element accessor.
fieldName | name of field in the structure. |
index | linear index of the struct array element. |
In MATLAB, this is equivalent to getting:
Example:
Definition at line 812 of file MxArray.cpp.
MxArray MxArray::at | ( | mwIndex | index | ) | const |
|
inlinestatic |
Create a new cell array.
m | Number of rows. |
n | Number of cols. |
Example:
Definition at line 290 of file MxArray.hpp.
|
inline |
Class ID of mxArray.
Definition at line 535 of file MxArray.hpp.
|
inline |
Class name of mxArray.
Definition at line 539 of file MxArray.hpp.
MxArray MxArray::clone | ( | ) | const |
Clone mxArray.
This allocates new mxArray*.
Definition at line 481 of file MxArray.cpp.
|
inline |
Number of columns in an array.
If the array is N-dimensional, this returns the product of dimensions 2 through N.
Definition at line 565 of file MxArray.hpp.
|
inline |
Deallocate memory occupied by mxArray.
Use this to destroy a temporary mxArray. Do not call this on arrays you are returning to MATLAB as left-hand side.
Definition at line 329 of file MxArray.hpp.
|
inline |
Array of each dimension.
Definition at line 554 of file MxArray.hpp.
|
inlinestatic |
Value of EPS
.
eps
.This variable holds the distance from 1.0 to the next largest floating-point number. As such, it is a measure of floating-point accuracy.
Definition at line 893 of file MxArray.hpp.
std::string MxArray::fieldname | ( | int | fieldnumber | ) | const |
Get specified field name from a struct array.
fieldnumber | position of the desired field. |
Definition at line 775 of file MxArray.cpp.
std::vector< std::string > MxArray::fieldnames | ( | ) | const |
Get field names of a struct array.
Definition at line 786 of file MxArray.cpp.
void MxArray::fromVector | ( | const std::vector< char > & | v | ) |
MxArray specialized constructor from vector<char>.
v | vector of type char. |
Definition at line 389 of file MxArray.cpp.
void MxArray::fromVector | ( | const std::vector< bool > & | v | ) |
MxArray specialized constructor from vector<bool>.
v | vector of type bool. |
Definition at line 399 of file MxArray.cpp.
|
inlinestatic |
Value of infinity.
Definition at line 881 of file MxArray.hpp.
|
inline |
Determine whether input is cell array.
mxCELL_CLASS
, false otherwise. Definition at line 610 of file MxArray.hpp.
|
inline |
Determine whether input is string array.
mxCHAR_CLASS
, false otherwise. Definition at line 614 of file MxArray.hpp.
|
inline |
Determine whether array is member of specified class.
s | class name as a string |
Example:
Definition at line 624 of file MxArray.hpp.
|
inline |
Determine whether data is complex.
Definition at line 632 of file MxArray.hpp.
|
inline |
Determine whether mxArray represents data as double-precision, floating-point numbers.
mxDOUBLE_CLASS
, false otherwise. Definition at line 637 of file MxArray.hpp.
|
inline |
Determine whether array is empty.
An array is empty if the size of any of its dimensions is 0.
Definition at line 643 of file MxArray.hpp.
|
inline |
Determine whether a struct array has a specified field.
fieldName | name of field to check |
Definition at line 743 of file MxArray.hpp.
|
inlinestatic |
Determine whether input is finite.
d | double-precision floating-point number |
Definition at line 648 of file MxArray.hpp.
|
inline |
Determine whether array represents data as floating-point numbers, both single and double precision.
Definition at line 738 of file MxArray.hpp.
|
inline |
Determine whether array was copied from MATLAB global workspace.
Definition at line 653 of file MxArray.hpp.
|
inlinestatic |
Determine whether input is infinite.
d | double-precision floating-point number |
Definition at line 658 of file MxArray.hpp.
|
inline |
Determine whether array represents data as signed 16-bit integers.
mxINT16_CLASS
, false otherwise. Definition at line 666 of file MxArray.hpp.
|
inline |
Determine whether array represents data as signed 32-bit integers.
mxINT32_CLASS
, false otherwise. Definition at line 670 of file MxArray.hpp.
|
inline |
Determine whether array represents data as signed 64-bit integers.
mxINT64_CLASS
, false otherwise. Definition at line 674 of file MxArray.hpp.
|
inline |
Determine whether array represents data as signed 8-bit integers.
mxINT8_CLASS
, false otherwise. Definition at line 662 of file MxArray.hpp.
|
inline |
Determine whether array represents data as integer types (8-bit, 16-bit, 32-bit or 64-bit, both signed and unsigned).
Definition at line 729 of file MxArray.hpp.
|
inline |
Determine whether array is of type mxLogical.
mxLOGICAL_CLASS
, false otherwise. Definition at line 678 of file MxArray.hpp.
|
inline |
Determine whether scalar array is of type mxLogical.
mxLOGICAL_CLASS
, false otherwise. Definition at line 683 of file MxArray.hpp.
|
inline |
Determine whether scalar array of type mxLogical
is true.
mxLOGICAL_CLASS
containing a value of true, returns false otherwise. Definition at line 688 of file MxArray.hpp.
|
inlinestatic |
Determine whether input is NaN (Not-a-Number).
d | double-precision floating-point number |
NaN
, false otherwise. Definition at line 877 of file MxArray.hpp.
|
inline |
Determine whether the array is initialized or not.
NULL
, false otherwise. Definition at line 606 of file MxArray.hpp.
|
inline |
Determine whether array is numeric.
Definition at line 695 of file MxArray.hpp.
|
inline |
Determine whether array represents data as single-precision, floating-point numbers.
mxSINGLE_CLASS
, false otherwise. Definition at line 700 of file MxArray.hpp.
|
inline |
Determine whether input is sparse array.
Definition at line 704 of file MxArray.hpp.
|
inline |
Determine whether input is structure array.
mxSTRUCT_CLASS
, false otherwise. Definition at line 708 of file MxArray.hpp.
|
inline |
Determine whether array represents data as unsigned 16-bit integers.
mxUINT16_CLASS
, false otherwise. Definition at line 716 of file MxArray.hpp.
|
inline |
Determine whether array represents data as unsigned 32-bit integers.
mxUINT32_CLASS
, false otherwise. Definition at line 720 of file MxArray.hpp.
|
inline |
Determine whether array represents data as unsigned 64-bit integers.
mxUINT64_CLASS
, false otherwise. Definition at line 724 of file MxArray.hpp.
|
inline |
Determine whether array represents data as unsigned 8-bit integers.
mxUINT8_CLASS
, false otherwise. Definition at line 712 of file MxArray.hpp.
|
inlinestatic |
Value of NaN
(Not-a-Number).
NaN
. Definition at line 885 of file MxArray.hpp.
|
inline |
Number of dimensions.
Definition at line 550 of file MxArray.hpp.
|
inline |
Number of fields in a struct array.
Definition at line 569 of file MxArray.hpp.
|
inline |
Number of elements in an array.
Definition at line 546 of file MxArray.hpp.
|
inline |
Number of elements in IR
, PR
, and PI
arrays.
Definition at line 583 of file MxArray.hpp.
|
inline |
Implicit conversion to const mxArray*.
Definition at line 333 of file MxArray.hpp.
|
inline |
Implicit conversion to mxArray*.
Be careful that this internally casts away mxArray* constness.
Definition at line 339 of file MxArray.hpp.
Assignment operator.
rhs | Reference to another MxArray. |
Definition at line 102 of file MxArray.cpp.
|
inline |
Number of rows in an array.
Definition at line 558 of file MxArray.hpp.
void MxArray::set | ( | mwIndex | index, |
const T & | value | ||
) |
Template for numeric array element write accessor.
index | linear index of the array element. |
value | value to assign to the element at the specified index. |
(If the array is a cell array, value
type must be convertible to MxArray using an existing constructor.)
In MATLAB, this is equivalent to setting:
Example:
Definition at line 1310 of file MxArray.hpp.
void MxArray::set | ( | mwIndex | i, |
mwIndex | j, | ||
const T & | value | ||
) |
Template for numeric array element write accessor.
i | index of the first dimension of the array element. |
j | index of the first dimension of the array element. |
value | value to assign to the element at the specified index. |
In MATLAB, this is equivalent to setting:
Definition at line 1370 of file MxArray.hpp.
void MxArray::set | ( | const std::vector< mwIndex > & | si, |
const T & | value | ||
) |
Template for numeric array element write accessor.
si | vector of subscripts for each dimension of the array. |
value | value to assign to the element at the specified subscript. |
In MATLAB, this is equivalent to setting:
Definition at line 1376 of file MxArray.hpp.
void MxArray::set | ( | const std::string & | fieldName, |
const T & | value, | ||
mwIndex | index = 0 |
||
) |
Template for struct array element write accessor.
fieldName | name of field in the structure. |
value | value to assign to the field. |
index | linear index of the struct array element. |
The value type must be convertible to MxArray using an existing constructor.
In MATLAB, this is equivalent to setting:
Example:
Definition at line 1382 of file MxArray.hpp.
void MxArray::set | ( | mwIndex | index, |
const MxArray & | value | ||
) |
Cell array element write accessor.
index | linear index of the cell array element. |
value | MxArray to assign to the element at the specified index. |
Example:
Definition at line 836 of file MxArray.cpp.
|
inlinestatic |
Create a new struct array.
fields | Field names. |
nfields | Number of fields. |
m | Number of rows (size of the first dimension). |
n | Number of cols (size of the second dimension). |
Example:
Definition at line 312 of file MxArray.hpp.
mwIndex MxArray::subs | ( | mwIndex | i, |
mwIndex | j = 0 |
||
) | const |
Offset from first element to desired element.
i | index of the first dimension of the array. |
j | index of the second dimension of the array. |
Return the offset (in number of elements) from the beginning of the array to the specified (i,j)
subscript.
Definition at line 798 of file MxArray.cpp.
mwIndex MxArray::subs | ( | const std::vector< mwIndex > & | si | ) | const |
Offset from first element to desired element.
si | vector of subscripts for each dimension of the array. |
Return the offset (in number of elements) from the beginning of the array to the specified subscript (si[0], si[1], ..., si[n])
.
Definition at line 806 of file MxArray.cpp.
bool MxArray::toBool | ( | ) | const |
cv::DMatch MxArray::toDMatch | ( | mwIndex | index = 0 | ) | const |
Convert MxArray to cv::DMatch.
index | linear index of the struct array element. |
Definition at line 734 of file MxArray.cpp.
double MxArray::toDouble | ( | ) | const |
float MxArray::toFloat | ( | ) | const |
int MxArray::toInt | ( | ) | const |
cv::KeyPoint MxArray::toKeyPoint | ( | mwIndex | index = 0 | ) | const |
Convert MxArray to cv::KeyPoint.
index | linear index of the struct array element. |
Definition at line 722 of file MxArray.cpp.
cv::Mat MxArray::toMat | ( | int | depth = CV_USRTYPE1 , |
bool | transpose = true |
||
) | const |
Convert MxArray to cv::Mat.
depth | depth of cv::Mat. e.g., CV_8U , CV_32F . When CV_USERTYPE1 is specified, depth will be automatically determined from the classid of the MxArray. default: CV_USERTYPE1 . |
transpose | Optional transposition to the return value so that rows and columns of the 2D Mat are mapped to the 2nd and 1st dimensions in MxArray, respectively. This does not apply the N-D array conversion. default true. |
Convert a MxArray object to a cv::Mat object. When the dimensionality of the MxArray is more than 2, the last dimension will be mapped to the channels of the cv::Mat. Also, if the resulting cv::Mat is 2D, the 1st and 2nd dimensions of the MxArray are mapped to rows and columns of the cv::Mat unless transpose
flag is false. That is, when MxArray is 3D, (dim 1, dim 2, dim 3)
are mapped to (cols, rows, channels)
of the cv::Mat by default, whereas if MxArray is more than 4D, (dim 1, dim 2, ..., dim N-1, dim N)
are mapped to (dim 2, dim 1, ..., dim N-1, channels)
of the cv::Mat, respectively.
Example:
Definition at line 529 of file MxArray.cpp.
cv::MatND MxArray::toMatND | ( | int | depth = CV_USRTYPE1 , |
bool | transpose = true |
||
) | const |
Convert MxArray to a single-channel cv::Mat.
depth | depth of cv::Mat. e.g., CV_8U , CV_32F . When CV_USERTYPE1 is specified, depth will be automatically determined from the the classid of the MxArray. default: CV_USERTYPE1 . |
transpose | Optional transposition to the return value so that rows and columns of the 2D Mat are mapped to the 2nd and 1st dimensions in MxArray, respectively. This does not apply the N-D array conversion. default true. |
Convert a MxArray object to a single-channel cv::Mat object. If the MxArray is 2D, the 1st and 2nd dimensions of the MxArray are mapped to rows and columns of the cv::Mat unless transpose
flag is false. If the MxArray is more than 3D, the 1st and 2nd dimensions of the MxArray are mapped to 2nd and 1st dimensions of the cv::Mat. That is, when MxArray is 2D, (dim 1, dim 2)
are mapped to (cols, rows)
of the cv::Mat by default, whereas if MxArray is more than 3D, (dim 1, dim 2, dim 3, ..., dim N)
are mapped to (dim 2, dim 1, dim 3, ..., dim N)
of the cv::Mat, respectively.
Example:
Definition at line 601 of file MxArray.cpp.
cv::Matx< T, m, n > MxArray::toMatx | ( | ) | const |
Convert MxArray to Matx<T,m,n>.
Definition at line 1131 of file MxArray.hpp.
cv::Moments MxArray::toMoments | ( | mwIndex | index = 0 | ) | const |
Convert MxArray to cv::Moments.
index | linear index of the struct array element. |
Definition at line 705 of file MxArray.cpp.
|
inline |
|
inline |
cv::Point3_< T > MxArray::toPoint3_ | ( | ) | const |
Convert MxArray to Point3_<T>.
Definition at line 1075 of file MxArray.hpp.
|
inline |
cv::Point_< T > MxArray::toPoint_ | ( | ) | const |
Convert MxArray to Point_<T>.
Definition at line 1067 of file MxArray.hpp.
cv::Range MxArray::toRange | ( | ) | const |
|
inline |
cv::Rect_< T > MxArray::toRect_ | ( | ) | const |
Convert MxArray to Rect_<T>.
Definition at line 1091 of file MxArray.hpp.
cv::RotatedRect MxArray::toRotatedRect | ( | mwIndex | index = 0 | ) | const |
Convert MxArray to cv::RotatedRect.
index | linear index of the struct array element. |
Definition at line 756 of file MxArray.cpp.
|
inline |
cv::Scalar_< T > MxArray::toScalar_ | ( | ) | const |
Convert MxArray to Scalar_<T>.
Definition at line 1099 of file MxArray.hpp.
|
inline |
cv::Size_< T > MxArray::toSize_ | ( | ) | const |
Convert MxArray to Size_<T>.
Definition at line 1083 of file MxArray.hpp.
cv::SparseMat MxArray::toSparseMat | ( | int | depth = CV_USRTYPE1 | ) | const |
Convert double sparse MxArray to 2D single-channel cv::SparseMat.
depth | depth of cv::SparseMat. e.g., CV_32F , CV_64F . When CV_USERTYPE1 is specified, depth will be automatically determined from the the classid of the MxArray (which is double, the only supported type for MATLAB sparse arrays). default: CV_USERTYPE1 . |
Definition at line 647 of file MxArray.cpp.
std::string MxArray::toString | ( | ) | const |
Convert MxArray to std::string.
Definition at line 517 of file MxArray.cpp.
cv::TermCriteria MxArray::toTermCriteria | ( | mwIndex | index = 0 | ) | const |
Convert MxArray to cv::TermCriteria.
index | linear index of the struct array element. |
Definition at line 765 of file MxArray.cpp.
cv::Vec< T, cn > MxArray::toVec | ( | ) | const |
Convert MxArray to Vec<T,cn>.
Definition at line 1114 of file MxArray.hpp.
std::vector< T > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<T> of primitive types.
The method is intended for conversion to a raw numeric vector such as std::vector<int> or std::vector<double>. Example:
Definition at line 1151 of file MxArray.hpp.
std::vector< T > MxArray::toVector | ( | std::const_mem_fun_ref_t< T, MxArray > | f | ) | const |
Convert MxArray to std::vector<T> by a specified conversion method.
f | member function of MxArray (e.g., &MxArray::toMat, &MxArray::toInt). |
The method constructs std::vector<T> by applying conversion method f
to each cell array element. This is similar to std::transform function. An example usage is shown below:
Definition at line 1239 of file MxArray.hpp.
std::vector< MxArray > MxArray::toVector | ( | ) | const |
std::vector< std::string > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<std::string>.
The input MxArray is expected to be a cell-array of strings, e.g: {'str1', 'str2', ...}
, or a single string 'str'
.
Example:
Definition at line 862 of file MxArray.cpp.
std::vector< cv::Mat > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<cv::Mat>.
The input MxArray can be either:
N
, e.g: {m1, m2, ...}
N=1
)where N
will be the output vector size.
Example:
Definition at line 869 of file MxArray.cpp.
std::vector< cv::Point > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point>.
The input MxArray can be either:
N
, e.g: {[x,y], [x,y], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [x,y; x,y; ...]
or cat(3, [x,x,...], [y,y,...])
where N
will be the output vector size.
Example:
Definition at line 880 of file MxArray.cpp.
std::vector< cv::Point2f > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point2f>.
The input MxArray can be either:
N
, e.g: {[x,y], [x,y], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [x,y; x,y; ...]
or cat(3, [x,x,...], [y,y,...])
where N
will be the output vector size.
Example:
Definition at line 898 of file MxArray.cpp.
std::vector< cv::Point2d > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point2d>.
The input MxArray can be either:
N
, e.g: {[x,y], [x,y], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [x,y; x,y; ...]
or cat(3, [x,x,...], [y,y,...])
where N
will be the output vector size.
Example:
Definition at line 916 of file MxArray.cpp.
std::vector< cv::Point3i > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point3i>.
The input MxArray can be either:
N
, e.g: {[x,y,z], [x,y,z], ...}
Nx3
, Nx1x3
, or 1xNx3
in the form: [x,y,z; x,y,z; ...]
or cat(3, [x,x,...], [y,y,...], [z,z,...])
where N
will be the output vector size.
Example:
Definition at line 934 of file MxArray.cpp.
std::vector< cv::Point3f > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point3f>.
The input MxArray can be either:
N
, e.g: {[x,y,z], [x,y,z], ...}
Nx3
, Nx1x3
, or 1xNx3
in the form: [x,y,z; x,y,z; ...]
or cat(3, [x,x,...], [y,y,...], [z,z,...])
where N
will be the output vector size.
Example:
Definition at line 952 of file MxArray.cpp.
std::vector< cv::Point3d > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Point3d>.
The input MxArray can be either:
N
, e.g: {[x,y,z], [x,y,z], ...}
Nx3
, Nx1x3
, or 1xNx3
in the form: [x,y,z; x,y,z; ...]
or cat(3, [x,x,...], [y,y,...], [z,z,...])
where N
will be the output vector size.
Example:
Definition at line 970 of file MxArray.cpp.
std::vector< cv::Size > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Size>.
The input MxArray can be either:
N
, e.g: {[w,h], [w,h], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [w,h; w,h; ...]
or cat(3, [w,w,...], [h,h,...])
where N
will be the output vector size.
Example:
Definition at line 988 of file MxArray.cpp.
std::vector< cv::Rect > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Rect>.
The input MxArray can be either:
N
, e.g: {[x,y,w,h], [x,y,w,h], ...}
Nx4
, Nx1x4
, or 1xNx4
in the form: [x,y,w,h; x,y,w,h; ...]
or cat(3, [x,x,...], [y,y,...] ,[w,w,...], [h,h,...])
where N
will be the output vector size.
Example:
Definition at line 1005 of file MxArray.cpp.
std::vector< cv::Vec2i > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec2i>.
The input MxArray can be either:
N
, e.g: {[v1,v2], [v1,v2], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [v1,v2; v1,v2; ...]
or cat(3, [v1,v1,...], [v2,v2,...])
where N
will be the output vector size.
Example:
Definition at line 1022 of file MxArray.cpp.
std::vector< cv::Vec2f > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec2f>.
The input MxArray can be either:
N
, e.g: {[v1,v2], [v1,v2], ...}
Nx2
, Nx1x2
, or 1xNx2
in the form: [v1,v2; v1,v2; ...]
or cat(3, [v1,v1,...], [v2,v2,...])
where N
will be the output vector size.
Example:
Definition at line 1040 of file MxArray.cpp.
std::vector< cv::Vec3i > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec3i>.
The input MxArray can be either:
N
, e.g: {[v1,v2,v3], [v1,v2,v3], ...}
Nx3
, Nx1x3
, or 1xNx3
in the form: [v1,v2,v3; v1,v2,v3; ...]
or cat(3, [v1,v1,...], [v2,v2,...], [v3,v3,...])
where N
will be the output vector size.
Example:
Definition at line 1058 of file MxArray.cpp.
std::vector< cv::Vec3f > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec3f>.
The input MxArray can be either:
N
, e.g: {[v1,v2,v3], [v1,v2,v3], ...}
Nx3
, Nx1x3
, or 1xNx3
in the form: [v1,v2,v3; v1,v2,v3; ...]
or cat(3, [v1,v1,...], [v2,v2,...], [v3,v3,...])
where N
will be the output vector size.
Example:
Definition at line 1076 of file MxArray.cpp.
std::vector< cv::Vec4i > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec4i>.
The input MxArray can be either:
N
, e.g: {[v1,v2,v3,v4], [v1,v2,v3,v4], ...}
Nx4
, Nx1x4
, or 1xNx4
in the form: [v1,v2,v3,v4; v1,v2,v3,v4; ...]
or cat(3, [v1,v1,...], [v2,v2,...], [v3,v3,...], [v4,v4,...])
where N
will be the output vector size.
Example:
Definition at line 1094 of file MxArray.cpp.
std::vector< cv::Vec4f > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<Vec4f>.
The input MxArray can be either:
N
, e.g: {[v1,v2,v3,v4], [v1,v2,v3,v4], ...}
Nx4
, Nx1x4
, or 1xNx4
in the form: [v1,v2,v3,v4; v1,v2,v3,v4; ...]
or cat(3, [v1,v1,...], [v2,v2,...], [v3,v3,...], [v4,v4,...])
where N
will be the output vector size.
Example:
Definition at line 1112 of file MxArray.cpp.
std::vector< cv::RotatedRect > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<cv::RotatedRect>.
The input MxArray can be either:
N
, e.g: {struct('center',[x,y], 'size',[a,b], 'angle',t), ...}
N
, in the form: struct('center',{[x,y],...}, 'size',{[a,b],...}, 'angle',{t,...})
where N
will be the output vector size.
Example:
Definition at line 1130 of file MxArray.cpp.
std::vector< cv::KeyPoint > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<cv::KeyPoint>.
The input MxArray can be either:
N
, e.g: {struct('pt',[x,y], 'size',[a,b], 'angle',t), ...}
N
, in the form: struct('pt',{[x,y],...}, 'size',{[a,b],...}, 'angle',{t,...})
where N
will be the output vector size.
Example:
Definition at line 1148 of file MxArray.cpp.
std::vector< cv::DMatch > MxArray::toVector | ( | ) | const |
Convert MxArray to std::vector<cv::DMatch>.
The input MxArray can be either:
N
, e.g: {struct('queryIdx',i, 'trainIdx',j, 'distance',d), ...}
N
, in the form: struct('queryIdx',{i,...}, 'trainIdx',{j,...}, 'distance',{d,...})
where N
will be the output vector size.
Example:
Definition at line 1166 of file MxArray.cpp.