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


C++ PointVector::resize方法代码示例

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


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

示例1: unProject

    void CylindricalPointProjector::unProject(PointVector &points, 
					      Gaussian3fVector &gaussians,
					      IntImage &indexImage,
					      const DepthImage &depthImage) const {
      assert(depthImage.rows > 0 && depthImage.cols > 0 && "CylindricalPointProjector: Depth image has zero dimensions");
      points.resize(depthImage.rows * depthImage.cols);
      gaussians.resize(depthImage.rows * depthImage.cols);
      indexImage.create(depthImage.rows, depthImage.cols);
      int count = 0;
      Point *point = &points[0];
      Gaussian3f *gaussian = &gaussians[0];
      for(int r = 0; r < depthImage.rows; r++) {
	const float *f = &depthImage(r, 0);
	int *i = &indexImage(r, 0);
	for(int c = 0; c < depthImage.cols; c++, f++, i++) {      
	  if(!_unProject(*point, c, r, *f)) {
	    *i = -1;
	    continue;
	  }
	  Eigen::Matrix3f cov = Eigen::Matrix3f::Identity();
	  *gaussian = Gaussian3f(point->head<3>(), cov);
	  gaussian++;
	  point++;
	  *i = count;
	  count++;
	}
      }
      points.resize(count);
      gaussians.resize(count);
    }
开发者ID:Jinqiang,项目名称:nicp,代码行数:30,代码来源:cylindricalpointprojector.cpp

示例2: unProject

  void SphericalPointProjector::unProject(PointVector &points, 
					  IntImage &indexImage,
					  const DepthImage &depthImage) const {
    if(_imageRows == 0 ||  _imageCols == 0) { 
      throw "SphericalPointProjector: Depth image has zero dimensions";
    }
    points.resize(depthImage.rows * depthImage.cols);
    int count = 0;
    indexImage.create(depthImage.rows, depthImage.cols);
    Point *point = &points[0];
    for(int r = 0; r < depthImage.rows; r++) {
      const float *f = &depthImage(r, 0);
      int *i = &indexImage(r, 0);
      for(int c = 0; c < depthImage.cols; c++, f++, i++) {
	if(!_unProject(*point, c, r, *f)) {
	  *i = -1;
	  continue;
	}
	point++;
	*i = count;
	count++;
      }
    }
    points.resize(count);
  }
开发者ID:yorsh87,项目名称:nicp,代码行数:25,代码来源:sphericalpointprojector.cpp

示例3: buildMassCenters

/*!
 * \brief buildMassCenters Use this function to retrieve the mass centers of _contours.
 * \param _contours Input contours.
 * \param _massCenters Output mass centers.
 */
void ContourManager::buildMassCenters(const ContourVector & _contours, PointVector & _massCenters)
{
    ContourVector::size_type contourSize = _contours.size();
    _massCenters.resize(contourSize);

    for (ContourVector::size_type i = 0; i < contourSize; ++i)
    {
        massCenter(_contours[i],_massCenters[i]);
    }//for(ContourVector::size_type i = 0; i < contourSize; ++i)
}//buildMassCenters
开发者ID:broija,项目名称:subdetection,代码行数:15,代码来源:contourmanager.cpp

示例4: unProject

  void PinholePointProjector::unProject(PointVector &points, 
					Gaussian3fVector &gaussians,
					IntImage &indexImage,
					const DepthImage &depthImage) const {
    assert(depthImage.rows > 0 && depthImage.cols > 0 && "PinholePointProjector: Depth image has zero dimensions");
    points.resize(depthImage.rows * depthImage.cols);
    gaussians.resize(depthImage.rows * depthImage.cols);
    indexImage.create(depthImage.rows, depthImage.cols);
    int count = 0;
    Point *point = &points[0];
    Gaussian3f *gaussian = &gaussians[0];
    float fB = _baseline * _cameraMatrix(0, 0);
    Eigen::Matrix3f J;
    for(int r = 0; r < depthImage.rows; r++) {
      const float *f = &depthImage(r, 0);
      int *i = &indexImage(r, 0);
      for(int c = 0; c < depthImage.cols; c++, f++, i++) {      
	if(!_unProject(*point, c, r, *f)) {
	  *i = -1;
	  continue;
	}
	float z = *f;
	float zVariation = (_alpha * z * z) / (fB + z * _alpha);
	J <<       
	  z, 0, (float)r,
	  0, z, (float)c,
	  0, 0, 1;
	J = _iK * J;
	Diagonal3f imageCovariance(3.0f, 3.0f, zVariation);
	Eigen::Matrix3f cov = J * imageCovariance * J.transpose();
	*gaussian = Gaussian3f(point->head<3>(), cov);
	gaussian++;
	point++;
	*i = count;
	count++;
      }
    }

    points.resize(count);
    gaussians.resize(count);
  }
开发者ID:Jinqiang,项目名称:g2o_frontend,代码行数:41,代码来源:pinholepointprojector.cpp

示例5: readMDXPoints

void readMDXPoints(PointVector &nodesCoords, istream &input, int number) {
    int index;
    nodesCoords.resize(number);
    for (int i = 0; i < number; i++)
    {
        // read the x y z coords for current node
        input >> index; // unused
        input >> nodesCoords.data[i + number*0];
        input >> nodesCoords.data[i + number*1];
        input >> nodesCoords.data[i + number*2];
    }
}
开发者ID:jcperezma,项目名称:Mechanistic-Model-cplusplus,代码行数:12,代码来源:Moldex+3D+flow+field+utilities.cpp


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