⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cvmat.hpp.svn-base

📁 这是于老师移植到dsp的源码
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
inline _CvMATConstElem_::operator CvScalar() const{    CvScalar scalar;    cvRawDataToScalar( ptr, type, &scalar );    return scalar;}inline double _CvMATConstElem_::operator ()( int coi ) const{   return CvMAT::get( ptr, type, coi );    }inline _CvMATElemCn_::_CvMATElemCn_( uchar* p, int t, int coi ) :    ptr(p), type(CV_MAT_DEPTH(t)){    if( coi )    {        assert( (unsigned)coi < (unsigned)CV_MAT_CN(t) );        ptr += coi * CV_ELEM_SIZE(type);    }}inline _CvMATElemCn_::operator double() const{   return CvMAT::get( ptr, type ); }inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const _CvMATConstElem_& elem ){    if( type == elem.type )        memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );    else    {        assert( CV_MAT_CN(elem.type) == 1 );        CvMAT::set( ptr, type, 0, elem(0));    }    return *this;}inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const _CvMATElemCn_& elem ){    if( type == elem.type )        memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );    else        CvMAT::set( ptr, type, 0, (double)elem );    return *this;}inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const CvScalar& scalar ){       CvMAT::set( ptr, type, 0, scalar.val[0] );    return *this;}inline _CvMATElemCn_& _CvMATElemCn_::operator = ( double d ){       CvMAT::set( ptr, type, 0, d );    return *this;}inline _CvMATElemCn_& _CvMATElemCn_::operator = ( float f ){       CvMAT::set( ptr, type, 0, (double)f );    return *this;}inline _CvMATElemCn_& _CvMATElemCn_::operator = ( int i ){       CvMAT::set( ptr, type, 0, i );    return *this;}inline _CvMATElem_::_CvMATElem_( uchar* p, int t ) : _CvMATConstElem_( (const uchar*)p, t ){}inline _CvMATElemCn_ _CvMATElem_::operator ()( int coi ){   return _CvMATElemCn_( ptr, type, coi ); }inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATConstElem_& elem ){    if( type == elem.type )        memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );    else    {        assert( CV_MAT_CN( type ^ elem.type ) == 0 );        CvScalar sc = (CvScalar)elem;        cvScalarToRawData( &sc, ptr, type, 0 );    }    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATElem_& elem ){    *this = (const _CvMATConstElem_&)elem;    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATElemCn_& elem ){    if( type == elem.type )        memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );    else        CvMAT::set( ptr, type, (double)elem );    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( const CvScalar& scalar ){    cvScalarToRawData( &scalar, ptr, type, 0 );    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( double d ){    CvMAT::set( ptr, type, d );    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( float f ){    CvMAT::set( ptr, type, (double)f );    return *this;}inline _CvMATElem_& _CvMATElem_::operator = ( int i ){    CvMAT::set( ptr, type, i );    return *this;}/********************************** CvMAT inline methods ********************************/inline CvMAT::CvMAT(){    memset( this, 0, sizeof(*this));}inline CvMAT::CvMAT( int rows, int cols, int type, void* data, int step ){    cvInitMatHeader( this, rows, cols, type, data, step );}inline CvMAT::CvMAT( int rows, int type, void* data, int step ){    cvInitMatHeader( this, rows, 1, type, data, step );}inline void CvMAT::create( int rows, int cols, int type ){    int step = cols*CV_ELEM_SIZE(type), total_size = step*rows;    this->rows = rows;    this->cols = cols;    this->step = rows == 1 ? 0 : step;    this->type = CV_MAT_MAGIC_VAL | (type & CV_MAT_TYPE_MASK) | CV_MAT_CONT_FLAG;    refcount = (int*)cvAlloc((size_t)total_size + 8);    data.ptr = (uchar*)(((size_t)(refcount + 1) + 7) & -8);    *refcount = 1;}inline CvMAT::CvMAT( int rows, int cols, int type ){    create( rows, cols, type );}inline CvMAT::CvMAT( int rows, int type ){    create( rows, 1, type );}inline CvMAT::CvMAT( const CvMat& mat ){    memcpy( this, &mat, sizeof(mat));    if( refcount )        (*refcount)++;}inline CvMAT::CvMAT( const CvMAT& mat ){    memcpy( this, &mat, sizeof(mat));    if( refcount )        (*refcount)++;}inline CvMAT::CvMAT( const IplImage& img ){    cvGetMat( &img, this );}inline void CvMAT::release(){    data.ptr = NULL;    if( refcount != NULL && --*refcount == 0 )        cvFree( (void**)&refcount );    refcount = 0;}inline CvMAT::~CvMAT(){    release();}inline CvMAT& CvMAT::operator = ( const CvMAT& mat ){    if( this != &mat )    {        release();        memcpy( this, &mat, sizeof(mat));        if( refcount )            (*refcount)++;    }    return *this;}inline CvMAT& CvMAT::operator = ( const CvMat& mat ){    *this = (const CvMAT&)mat;    return *this;}inline CvMAT& CvMAT::operator = ( const IplImage& img ){    release();    cvGetMat( &img, this );    return *this;}inline CvMAT& CvMAT::operator = ( double fillval ){    cvFillImage( this, fillval );    return *this;}inline CvMAT& CvMAT::operator = ( const CvScalar& fillval ){    cvSet( this, fillval );    return *this;}inline CvMAT& CvMAT::operator += ( const CvMat& mat ){    cvAdd( this, &mat, this );    return *this;}inline CvMAT& CvMAT::operator += ( double val ){    cvAddS( this, cvScalar(val), this );    return *this;}inline CvMAT& CvMAT::operator += ( const CvScalar& val ){    cvAddS( this, val, this );    return *this;}inline CvMAT& CvMAT::operator -= ( const CvMat& mat ){    cvSub( this, &mat, this );    return *this;}inline CvMAT& CvMAT::operator -= ( double val ){    cvSubS( this, cvScalar(val), this );    return *this;}inline CvMAT& CvMAT::operator -= ( const CvScalar& val ){    cvSubS( this, val, this );    return *this;}inline CvMAT& CvMAT::operator *= ( const CvMat& mat ){    cvMul( this, &mat, this );    return *this;    }inline CvMAT& CvMAT::operator *= ( double val ){    cvScale( this, this, val, 0 );    return *this;}inline CvMAT& CvMAT::operator *= ( const CvScalar& val ){    cvScaleAdd( this, val, 0, this );    return *this;}inline CvMAT& CvMAT::operator &= ( const CvMat& mat ){    cvAnd( this, &mat, this );    return *this;}inline CvMAT& CvMAT::operator &= ( double val ){    cvAndS( this, cvScalarAll(val), this );    return *this;}inline CvMAT& CvMAT::operator &= ( const CvScalar& val ){    cvAndS( this, val, this );    return *this;}inline CvMAT& CvMAT::operator |= ( const CvMat& mat ){    cvOr( this, &mat, this );    return *this;}inline CvMAT& CvMAT::operator |= ( double val ){    cvOrS( this, cvScalarAll(val), this );    return *this;}inline CvMAT& CvMAT::operator |= ( const CvScalar& val ){    cvOrS( this, val, this );    return *this;}inline CvMAT& CvMAT::operator ^= ( const CvMat& mat ){    cvXor( this, &mat, this );    return *this;}inline CvMAT& CvMAT::operator ^= ( double val ){    cvXorS( this, cvScalarAll(val), this );    return *this;}inline CvMAT& CvMAT::operator ^= ( const CvScalar& val ){    cvXorS( this, val, this );    return *this;}inline double CvMAT::norm( int normType ) const{   return cvNorm( this, 0, normType ); }inline double CvMAT::min( CvPoint* minloc ) const{       double t;    cvMinMaxLoc( this, &t, 0, minloc, 0, 0 );    return t;}inline double CvMAT::max( CvPoint* maxloc ) const{       double t;    cvMinMaxLoc( this, 0, &t, 0, maxloc, 0 );    return t;}inline double CvMAT::norm( CvMat& mat, int normType ) const{   return cvNorm( this, &mat, normType );  }inline CvScalar CvMAT::sum() const{   return cvSum( this );   }inline double CvMAT::det() const{   return cvDet( this );   }inline void CvMAT::reshape( int newcn, int newrows ){   cvReshape( this, this, newcn, newrows );    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -