本文整理汇总了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);
}
示例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);
}
示例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
示例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);
}
示例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];
}
}