当前位置: 首页>>代码示例>>C++>>正文


C++ ivector::begin方法代码示例

本文整理汇总了C++中ivector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ivector::begin方法的具体用法?C++ ivector::begin怎么用?C++ ivector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ivector的用法示例。


在下文中一共展示了ivector::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tmp

  inline void hom8DofHelper<T,U>::initialize(const matrix<tpoint<U> >& src,
                                             const ivector& indices,
                                             const int numCorrespondences,
                                             vector<T>& AtA11,
                                             matrix<T>& AtA31,
                                             matrix<T>& AtA32,
                                             vector<T>& AtA33,
                                             vector<T>& dest) const {
        
     //------ least squares problem: A * dest = b
    
    //---------------------------------------------------
    //references for fast access of the vector's elements
    //---------------------------------------------------
    //----------------
    //A_transponed * b
    //----------------
    dest.resize(8, T(0), false, true);
    typename vector<T>::iterator vit ( dest.begin() );
    T& d0 = *vit;
    T& d1 = *(++vit);
    T& d2 = *(++vit);
    T& d3 = *(++vit);
    T& d4 = *(++vit);
    T& d5 = *(++vit);
    T& d6 = *(++vit);
    T& d7 = *(++vit);
    //-------------
    //submatrix 1.1, 3x3, symectric, only triagonal part is computed
    //-------------
    AtA11.resize ( 6, T(0), false, true );
    vit = AtA11.begin();
    T& a11_0 = *vit;
    T& a11_1 = *(++vit);
    T& a11_2 = *(++vit);
    T& a11_3 = *(++vit);
    T& a11_4 = *(++vit);
    *(++vit) = static_cast<T>(src.columns());
    //-------------
    //submatrix 3.1, 2x3
    //-------------   
    AtA31.resize ( 2, 3, T(0), false, true );
    typename matrix<T>::iterator mit ( AtA31.begin() );
    T& a31_0 = *mit;
    T& a31_1 = *(++mit);
    T& a31_2 = *(++mit);
    T& a31_3 = *(++mit);
    T& a31_4 = *(++mit);
    T& a31_5 = *(++mit);
    //-------------
    //submatrix 3.2, 2x3
    //-------------   
    AtA32.resize( 2, 3, T(0), false, true );
    mit = AtA32.begin();
    T& a32_0 = *mit;
    T& a32_1 = *(++mit);
    T& a32_2 = *(++mit);
    T& a32_3 = *(++mit);
    T& a32_4 = *(++mit);
    T& a32_5 = *(++mit);
    //-------------
    //submatrix 3.3, 2x2
    //-------------   
    AtA33.resize( 3, T(0), false, true );
    vit = AtA33.begin();
    T& a33_0 = *vit;
    T& a33_1 = *(++vit);
    T& a33_2 = *(++vit);

    //--------------------
    //init all submatrices
    //--------------------

    const vector<tpoint<U> >& pts1 = src.getRow(0);
    const vector<tpoint<U> >& pts2 = src.getRow(1);
    typename ivector::const_iterator it  ( indices.begin() );
    typename ivector::const_iterator end ( it + numCorrespondences );
    for (; it!=end; ++it) {

      const tpoint<U>& pt1 = pts1.at(*it);
      const T x1 ( static_cast<T>(pt1.x) );
      const T y1 ( static_cast<T>(pt1.y) );
      const T sqX1 ( x1*x1 );
      const T sqY1 ( y1*y1 );
      const T x1Y1 ( x1*y1 );

      a11_0 += sqX1;
      a11_1 += x1Y1;
      a11_2 += x1;
      a11_3 += sqY1;
      a11_4 += y1;

      const tpoint<U>& pt2 = pts2.at(*it);
      const T x2 ( static_cast<T>(pt2.x) );
      const T y2 ( static_cast<T>(pt2.y) );

      a31_0 -= sqX1 * x2;
      a31_1 -= x1Y1 * x2;
      a31_2 -= x1 * x2;
      a31_4 -= sqY1 * x2;
//.........这里部分代码省略.........
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:101,代码来源:ltiHomography8DofEstimator.cpp


注:本文中的ivector::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。