本文整理汇总了C++中eigen::MatrixXf::swap方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXf::swap方法的具体用法?C++ MatrixXf::swap怎么用?C++ MatrixXf::swap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXf
的用法示例。
在下文中一共展示了MatrixXf::swap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: A
//.........这里部分代码省略.........
PCL_DEBUG (" Iteration %d (height threshold = %f, window size = %f, half size = %d)...",
i, height_thresholds[i], window_sizes[i], half_sizes[i]);
// Limit filtering to those points currently considered ground returns
typename pcl::PointCloud<PointT>::Ptr cloud (new pcl::PointCloud<PointT>);
pcl::copyPointCloud<PointT> (*input_, ground, *cloud);
// Apply the morphological opening operation at the current window size.
#ifdef _OPENMP
#pragma omp parallel for num_threads(threads_)
#endif
for (int row = 0; row < rows; ++row)
{
int rs, re;
rs = ((row - half_sizes[i]) < 0) ? 0 : row - half_sizes[i];
re = ((row + half_sizes[i]) > (rows-1)) ? (rows-1) : row + half_sizes[i];
for (int col = 0; col < cols; ++col)
{
int cs, ce;
cs = ((col - half_sizes[i]) < 0) ? 0 : col - half_sizes[i];
ce = ((col + half_sizes[i]) > (cols-1)) ? (cols-1) : col + half_sizes[i];
float min_coeff = std::numeric_limits<float>::max ();
for (int j = rs; j < (re + 1); ++j)
{
for (int k = cs; k < (ce + 1); ++k)
{
if (A (j, k) != std::numeric_limits<float>::quiet_NaN ())
{
if (A (j, k) < min_coeff)
min_coeff = A (j, k);
}
}
}
if (min_coeff != std::numeric_limits<float>::max ())
Z(row, col) = min_coeff;
}
}
#ifdef _OPENMP
#pragma omp parallel for num_threads(threads_)
#endif
for (int row = 0; row < rows; ++row)
{
int rs, re;
rs = ((row - half_sizes[i]) < 0) ? 0 : row - half_sizes[i];
re = ((row + half_sizes[i]) > (rows-1)) ? (rows-1) : row + half_sizes[i];
for (int col = 0; col < cols; ++col)
{
int cs, ce;
cs = ((col - half_sizes[i]) < 0) ? 0 : col - half_sizes[i];
ce = ((col + half_sizes[i]) > (cols-1)) ? (cols-1) : col + half_sizes[i];
float max_coeff = -std::numeric_limits<float>::max ();
for (int j = rs; j < (re + 1); ++j)
{
for (int k = cs; k < (ce + 1); ++k)
{
if (Z (j, k) != std::numeric_limits<float>::quiet_NaN ())
{
if (Z (j, k) > max_coeff)
max_coeff = Z (j, k);
}
}
}
if (max_coeff != -std::numeric_limits<float>::max ())
Zf (row, col) = max_coeff;
}
}
// Find indices of the points whose difference between the source and
// filtered point clouds is less than the current height threshold.
std::vector<int> pt_indices;
for (boost::int32_t p_idx = 0; p_idx < ground.size (); ++p_idx)
{
PointT p = cloud->points[p_idx];
int erow = static_cast<int> (std::floor ((p.y - global_min.y ()) / cell_size_));
int ecol = static_cast<int> (std::floor ((p.x - global_min.x ()) / cell_size_));
float diff = p.z - Zf (erow, ecol);
if (diff < height_thresholds[i])
pt_indices.push_back (ground[p_idx]);
}
A.swap (Zf);
// Ground is now limited to pt_indices
ground.swap (pt_indices);
PCL_DEBUG ("ground now has %d points\n", ground.size ());
}
deinitCompute ();
}