Move cv::Mat out of core.hpp

This commit is contained in:
Andrey Kamaev
2013-03-28 21:01:12 +04:00
parent 135c0b6cb5
commit 715fa3303e
46 changed files with 1854 additions and 1731 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -441,9 +441,18 @@ class CV_EXPORTS Mat;
class CV_EXPORTS SparseMat;
typedef Mat MatND;
class CV_EXPORTS MatExpr;
template<typename _Tp> class CV_EXPORTS Mat_;
template<typename _Tp> class CV_EXPORTS SparseMat_;
class CV_EXPORTS MatConstIterator;
class CV_EXPORTS SparseMatIterator;
class CV_EXPORTS SparseMatConstIterator;
template<typename _Tp> class CV_EXPORTS MatIterator_;
template<typename _Tp> class CV_EXPORTS MatConstIterator_;
template<typename _Tp> class CV_EXPORTS SparseMatIterator_;
template<typename _Tp> class CV_EXPORTS SparseMatConstIterator_;
namespace ogl
{

File diff suppressed because it is too large Load Diff

View File

@@ -383,15 +383,6 @@ inline Mat Mat::operator()(const Range* ranges) const
return Mat(*this, ranges);
}
inline Mat::operator CvMat() const
{
CV_DbgAssert(dims <= 2);
CvMat m = cvMat(rows, dims == 1 ? 1 : cols, type(), data);
m.step = (int)step[0];
m.type = (m.type & ~CONTINUOUS_FLAG) | (flags & CONTINUOUS_FLAG);
return m;
}
inline bool Mat::isContinuous() const { return (flags & CONTINUOUS_FLAG) != 0; }
inline bool Mat::isSubmatrix() const { return (flags & SUBMATRIX_FLAG) != 0; }
inline size_t Mat::elemSize() const { return dims > 0 ? step.p[dims-1] : 0; }
@@ -2411,11 +2402,11 @@ template<typename _Tp> inline SparseMat_<_Tp>::SparseMat_(const Mat& m)
*this = sm;
}
template<typename _Tp> inline SparseMat_<_Tp>::SparseMat_(const CvSparseMat* m)
{
SparseMat sm(m);
*this = sm;
}
// template<typename _Tp> inline SparseMat_<_Tp>::SparseMat_(const CvSparseMat* m)
// {
// SparseMat sm(m);
// *this = sm;
// }
template<typename _Tp> inline SparseMat_<_Tp>&
SparseMat_<_Tp>::operator = (const SparseMat_<_Tp>& m)
@@ -2457,11 +2448,11 @@ SparseMat_<_Tp>::create(int _dims, const int* _sizes)
SparseMat::create(_dims, _sizes, DataType<_Tp>::type);
}
template<typename _Tp> inline
SparseMat_<_Tp>::operator CvSparseMat*() const
{
return SparseMat::operator CvSparseMat*();
}
// template<typename _Tp> inline
// SparseMat_<_Tp>::operator CvSparseMat*() const
// {
// return SparseMat::operator CvSparseMat*();
// }
template<typename _Tp> inline int SparseMat_<_Tp>::type() const
{ return DataType<_Tp>::type; }

View File

@@ -94,6 +94,7 @@
#ifdef __cplusplus
# include "opencv2/core/types.hpp"
# include "opencv2/core/mat.hpp"
#endif
/* CvArr* is used to pass arbitrary
@@ -307,6 +308,11 @@ typedef struct _IplImage
char *imageDataOrigin; /* Pointer to very origin of image data
(not necessarily aligned) -
needed for correct deallocation */
#ifdef __cplusplus
_IplImage() {}
_IplImage(const cv::Mat& m);
#endif
}
IplImage;
@@ -417,6 +423,12 @@ typedef struct CvMat
int cols;
#endif
#ifdef __cplusplus
CvMat() {}
CvMat(const cv::Mat& m);
#endif
}
CvMat;
@@ -478,6 +490,16 @@ CV_INLINE CvMat cvMat( int rows, int cols, int type, void* data CV_DEFAULT(NULL)
return m;
}
#ifdef __cplusplus
inline CvMat::CvMat(const cv::Mat& m)
{
CV_DbgAssert(m.dims <= 2);
*this = cvMat(m.rows, m.dims == 1 ? 1 : m.cols, m.type(), m.data);
step = (int)m.step[0];
type = (type & ~cv::Mat::CONTINUOUS_FLAG) | (m.flags & cv::Mat::CONTINUOUS_FLAG);
}
#endif
#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size ) \
(assert( (unsigned)(row) < (unsigned)(mat).rows && \
@@ -567,6 +589,11 @@ typedef struct CvMatND
int step;
}
dim[CV_MAX_DIM];
#ifdef __cplusplus
CvMatND() {}
CvMatND(const cv::Mat& m);
#endif
}
CvMatND;
@@ -586,7 +613,7 @@ CvMatND;
struct CvSet;
typedef struct CvSparseMat
typedef struct CV_EXPORTS CvSparseMat
{
int type;
int dims;
@@ -599,9 +626,17 @@ typedef struct CvSparseMat
int valoffset;
int idxoffset;
int size[CV_MAX_DIM];
#ifdef __cplusplus
void copyToSparseMat(cv::SparseMat& m) const;
#endif
}
CvSparseMat;
#ifdef __cplusplus
CvSparseMat* cvCreateSparseMat(const cv::SparseMat& m);
#endif
#define CV_IS_SPARSE_MAT_HDR(mat) \
((mat) != NULL && \
(((const CvSparseMat*)(mat))->type & CV_MAGIC_MASK) == CV_SPARSE_MAT_MAGIC_VAL)