|
|
|
@@ -6,7 +6,7 @@
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <opencv2/core.hpp>
|
|
|
|
|
#include <opencv2/calib3d.hpp>
|
|
|
|
|
#include <ext/hash_map>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* All recent versions of Matlab ship with the MKL library which contains
|
|
|
|
@@ -208,7 +208,7 @@ private:
|
|
|
|
|
// this function is called exclusively from constructors!!
|
|
|
|
|
template <typename Scalar>
|
|
|
|
|
void fromMat(const cv::Mat& mat) {
|
|
|
|
|
mwSize dims[] = { mat.rows, mat.cols, mat.channels() };
|
|
|
|
|
mwSize dims[] = { static_cast<mwSize>(mat.rows), static_cast<mwSize>(mat.cols), static_cast<mwSize>(mat.channels()) };
|
|
|
|
|
ptr_ = mxCreateNumericArray(3, dims, Matlab::Traits<Scalar>::ScalarType, Matlab::Traits<>::Real);
|
|
|
|
|
owns_ = true;
|
|
|
|
|
switch (mat.depth()) {
|
|
|
|
@@ -412,28 +412,28 @@ cv::Mat MxArray::toMat<Matlab::InheritType>() const {
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
template <typename InputScalar, typename OutputScalar>
|
|
|
|
|
void deepCopyAndTranspose(const cv::Mat& src, MxArray& dst) {
|
|
|
|
|
void deepCopyAndTranspose(const cv::Mat&, MxArray&) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename InputScalar, typename OutputScalar>
|
|
|
|
|
void deepCopyAndTranspose(const MxArray& src, cv::Mat& dst) {
|
|
|
|
|
void deepCopyAndTranspose(const MxArray&, cv::Mat&) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void deepCopyAndTranspose<float, float>(const cv::Mat& src, MxArray& dst) {
|
|
|
|
|
void deepCopyAndTranspose<float, float>(const cv::Mat&, MxArray&) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void deepCopyAndTranspose<double, double>(const cv::Mat& src, MxArray& dst) {
|
|
|
|
|
void deepCopyAndTranspose<double, double>(const cv::Mat&, MxArray&) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void deepCopyAndTranspose<float, float>(const MxArray& src, cv::Mat& dst) {
|
|
|
|
|
void deepCopyAndTranspose<float, float>(const MxArray&, cv::Mat&) {
|
|
|
|
|
// use mkl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
void deepCopyAndTranspose<double, double>(const MxArray& src, cv::Mat& dst) {
|
|
|
|
|
void deepCopyAndTranspose<double, double>(const MxArray&, cv::Mat& ) {
|
|
|
|
|
// use mkl
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -535,7 +535,7 @@ public:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
// MATLAB TYPES
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
Bridge& operator=(const mxArray* obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const mxArray*) { return *this; }
|
|
|
|
|
Bridge(const mxArray* obj) : ptr_(obj) {}
|
|
|
|
|
MxArray toMxArray() { return ptr_; }
|
|
|
|
|
|
|
|
|
@@ -548,29 +548,29 @@ public:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// --------------------------- string --------------------------------------
|
|
|
|
|
Bridge& operator=(const std::string& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const std::string& ) { return *this; }
|
|
|
|
|
std::string toString() {
|
|
|
|
|
return ptr_.toString();
|
|
|
|
|
}
|
|
|
|
|
operator std::string() { return toString(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- bool --------------------------------------
|
|
|
|
|
Bridge& operator=(const bool& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const bool& ) { return *this; }
|
|
|
|
|
bool toBool() { return 0; }
|
|
|
|
|
operator bool() { return toBool(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- double --------------------------------------
|
|
|
|
|
Bridge& operator=(const double& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const double& ) { return *this; }
|
|
|
|
|
double toDouble() { return ptr_.scalar<double>(); }
|
|
|
|
|
operator double() { return toDouble(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- float ---------------------------------------
|
|
|
|
|
Bridge& operator=(const float& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const float& ) { return *this; }
|
|
|
|
|
float toFloat() { return ptr_.scalar<float>(); }
|
|
|
|
|
operator float() { return toFloat(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- int --------------------------------------
|
|
|
|
|
Bridge& operator=(const int& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const int& ) { return *this; }
|
|
|
|
|
int toInt() { return ptr_.scalar<int>(); }
|
|
|
|
|
operator int() { return toInt(); }
|
|
|
|
|
|
|
|
|
@@ -583,57 +583,57 @@ public:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// --------------------------- cv::Mat --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Mat& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Mat& ) { return *this; }
|
|
|
|
|
cv::Mat toMat() const { return ptr_.toMat<Matlab::InheritType>(); }
|
|
|
|
|
operator cv::Mat() const { return toMat(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Point --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Point& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Point& ) { return *this; }
|
|
|
|
|
cv::Point toPoint() const { return cv::Point(); }
|
|
|
|
|
operator cv::Point() const { return toPoint(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Point2f ------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Point2f& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Point2f& ) { return *this; }
|
|
|
|
|
cv::Point2f toPoint2f() const { return cv::Point2f(); }
|
|
|
|
|
operator cv::Point2f() const { return toPoint2f(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Point2d ------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Point2d& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Point2d& ) { return *this; }
|
|
|
|
|
cv::Point2d toPoint2d() const { return cv::Point2d(); }
|
|
|
|
|
operator cv::Point2d() const { return toPoint2d(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Size ---------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Size& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Size& ) { return *this; }
|
|
|
|
|
cv::Size toSize() const { return cv::Size(); }
|
|
|
|
|
operator cv::Size() const { return toSize(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Moments --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Moments& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Moments& ) { return *this; }
|
|
|
|
|
cv::Moments toMoments() const { return cv::Moments(); }
|
|
|
|
|
operator cv::Moments() const { return toMoments(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Scalar --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Scalar& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Scalar& ) { return *this; }
|
|
|
|
|
cv::Scalar toScalar() { return cv::Scalar(); }
|
|
|
|
|
operator cv::Scalar() { return toScalar(); }
|
|
|
|
|
|
|
|
|
|
// -------------------------- Rect -----------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::Rect& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::Rect& ) { return *this; }
|
|
|
|
|
cv::Rect toRect() { return cv::Rect(); }
|
|
|
|
|
operator cv::Rect() { return toRect(); }
|
|
|
|
|
|
|
|
|
|
// ---------------------- RotatedRect ---------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::RotatedRect& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::RotatedRect& ) { return *this; }
|
|
|
|
|
cv::RotatedRect toRotatedRect() { return cv::RotatedRect(); }
|
|
|
|
|
operator cv::RotatedRect() { return toRotatedRect(); }
|
|
|
|
|
|
|
|
|
|
// ---------------------- TermCriteria --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::TermCriteria& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::TermCriteria& ) { return *this; }
|
|
|
|
|
cv::TermCriteria toTermCriteria() { return cv::TermCriteria(); }
|
|
|
|
|
operator cv::TermCriteria() { return toTermCriteria(); }
|
|
|
|
|
|
|
|
|
|
// ---------------------- RNG --------------------------------------
|
|
|
|
|
Bridge& operator=(const cv::RNG& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const cv::RNG& ) { return *this; }
|
|
|
|
|
/*! @brief explicit conversion to cv::RNG()
|
|
|
|
|
*
|
|
|
|
|
* Converts a bridge object to a cv::RNG(). We explicitly assert that
|
|
|
|
@@ -654,42 +654,42 @@ public:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// -------------------- vector_Mat ------------------------------------------
|
|
|
|
|
Bridge& operator=(const vector_Mat& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_Mat& ) { return *this; }
|
|
|
|
|
vector_Mat toVectorMat() { return vector_Mat(); }
|
|
|
|
|
operator vector_Mat() { return toVectorMat(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- vector_int ----------------------------------
|
|
|
|
|
Bridge& operator=(const vector_int& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_int& ) { return *this; }
|
|
|
|
|
vector_int toVectorInt() { return vector_int(); }
|
|
|
|
|
operator vector_int() { return toVectorInt(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- vector_float --------------------------------
|
|
|
|
|
Bridge& operator=(const vector_float& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_float& ) { return *this; }
|
|
|
|
|
vector_float toVectorFloat() { return vector_float(); }
|
|
|
|
|
operator vector_float() { return toVectorFloat(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- vector_Rect ---------------------------------
|
|
|
|
|
Bridge& operator=(const vector_Rect& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_Rect& ) { return *this; }
|
|
|
|
|
vector_Rect toVectorRect() { return vector_Rect(); }
|
|
|
|
|
operator vector_Rect() { return toVectorRect(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- vector_KeyPoint -----------------------------
|
|
|
|
|
Bridge& operator=(const vector_KeyPoint& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_KeyPoint& ) { return *this; }
|
|
|
|
|
vector_KeyPoint toVectorKeyPoint() { return vector_KeyPoint(); }
|
|
|
|
|
operator vector_KeyPoint() { return toVectorKeyPoint(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- vector_String -------------------------------
|
|
|
|
|
Bridge& operator=(const vector_String& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_String& ) { return *this; }
|
|
|
|
|
vector_String toVectorString() { return vector_String(); }
|
|
|
|
|
operator vector_String() { return toVectorString(); }
|
|
|
|
|
|
|
|
|
|
// ------------------------ vector_Point ------------------------------------
|
|
|
|
|
Bridge& operator=(const vector_Point& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_Point& ) { return *this; }
|
|
|
|
|
vector_Point toVectorPoint() { return vector_Point(); }
|
|
|
|
|
operator vector_Point() { return toVectorPoint(); }
|
|
|
|
|
|
|
|
|
|
// ------------------------ vector_uchar ------------------------------------
|
|
|
|
|
Bridge& operator=(const vector_uchar& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const vector_uchar& ) { return *this; }
|
|
|
|
|
vector_uchar toVectorUchar() { return vector_uchar(); }
|
|
|
|
|
operator vector_uchar() { return toVectorUchar(); }
|
|
|
|
|
|
|
|
|
@@ -702,17 +702,17 @@ public:
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
// --------------------------- Ptr_StereoBM -----------------------------
|
|
|
|
|
Bridge& operator=(const Ptr_StereoBM& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const Ptr_StereoBM& ) { return *this; }
|
|
|
|
|
Ptr_StereoBM toPtrStereoBM() { return Ptr_StereoBM(); }
|
|
|
|
|
operator Ptr_StereoBM() { return toPtrStereoBM(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- Ptr_StereoSGBM ---------------------------
|
|
|
|
|
Bridge& operator=(const Ptr_StereoSGBM& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const Ptr_StereoSGBM& ) { return *this; }
|
|
|
|
|
Ptr_StereoSGBM toPtrStereoSGBM() { return Ptr_StereoSGBM(); }
|
|
|
|
|
operator Ptr_StereoSGBM() { return toPtrStereoSGBM(); }
|
|
|
|
|
|
|
|
|
|
// --------------------------- Ptr_FeatureDetector ----------------------
|
|
|
|
|
Bridge& operator=(const Ptr_FeatureDetector& obj) { return *this; }
|
|
|
|
|
Bridge& operator=(const Ptr_FeatureDetector& ) { return *this; }
|
|
|
|
|
Ptr_FeatureDetector toPtrFeatureDetector() { return Ptr_FeatureDetector(); }
|
|
|
|
|
operator Ptr_FeatureDetector() { return toPtrFeatureDetector(); }
|
|
|
|
|
|
|
|
|
|