本文整理汇总了C++中CFeatureList::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ CFeatureList::erase方法的具体用法?C++ CFeatureList::erase怎么用?C++ CFeatureList::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFeatureList
的用法示例。
在下文中一共展示了CFeatureList::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trackFeatures_deleteOOB
inline size_t trackFeatures_deleteOOB(
CFeatureList &trackedFeats,
const size_t img_width, const size_t img_height,
const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
{
CFeatureList::iterator itFeat = trackedFeats.begin();
size_t n_removed = 0;
while (itFeat!=trackedFeats.end())
{
const TFeatureTrackStatus status = (*itFeat)->track_status;
bool eras = (status_TRACKED!=status && status_IDLE!=status);
if (!eras)
{
// Also, check if it's too close to the image border:
const float x= (*itFeat)->x;
const float y= (*itFeat)->y;
static const float MIN_DIST_MARGIN_TO_STOP_TRACKING = 10;
if (x<MIN_DIST_MARGIN_TO_STOP_TRACKING || y<MIN_DIST_MARGIN_TO_STOP_TRACKING ||
x>(img_width-MIN_DIST_MARGIN_TO_STOP_TRACKING) ||
y>(img_height-MIN_DIST_MARGIN_TO_STOP_TRACKING))
{
eras = true;
}
}
if (eras) // Erase or keep?
{
itFeat = trackedFeats.erase(itFeat);
n_removed++;
}
else ++itFeat;
}
return n_removed;
} // end of trackFeatures_deleteOOB
示例2: Test_Kinect
//.........这里部分代码省略.........
CImage theImg; // The grabbed image:
theImg = last_obs->intensityImage;
// Do tracking:
if (step_num > 1) // we need "previous_image" to be valid.
{
tracker->trackFeatures(previous_image, theImg, trackedFeats);
// Remove those now out of the image plane:
CFeatureList::iterator itFeat = trackedFeats.begin();
while (itFeat != trackedFeats.end())
{
const TFeatureTrackStatus status = (*itFeat)->track_status;
bool eras =
(status_TRACKED != status && status_IDLE != status);
if (!eras)
{
// Also, check if it's too close to the image border:
const float x = (*itFeat)->x;
const float y = (*itFeat)->y;
static const float MIN_DIST_MARGIN_TO_STOP_TRACKING =
10;
if (x < MIN_DIST_MARGIN_TO_STOP_TRACKING ||
y < MIN_DIST_MARGIN_TO_STOP_TRACKING ||
x > (last_obs->cameraParamsIntensity.ncols -
MIN_DIST_MARGIN_TO_STOP_TRACKING) ||
y > (last_obs->cameraParamsIntensity.nrows -
MIN_DIST_MARGIN_TO_STOP_TRACKING))
{
eras = true;
}
}
if (eras) // Erase or keep?
itFeat = trackedFeats.erase(itFeat);
else
++itFeat;
}
}
// Create list of 3D features in space, wrt current camera pose:
// --------------------------------------------------------------------
map<TFeatureID, TPoint3D> curVisibleFeats;
for (CFeatureList::iterator itFeat = trackedFeats.begin();
itFeat != trackedFeats.end(); ++itFeat)
{
// Pixel coordinates in the intensity image:
const int int_x = (*itFeat)->x;
const int int_y = (*itFeat)->y;
// Convert to pixel coords in the range image:
// APPROXIMATION: Assume coordinates are equal (that's not
// exact!!)
const int x = int_x;
const int y = int_y;
// Does this (x,y) have valid range data?
const float d = last_obs->rangeImage(y, x);
if (d > 0.05 && d < 10.0)
{
ASSERT_(
size_t(
last_obs->rangeImage.cols() *
last_obs->rangeImage.rows()) ==
last_obs->points3D_x.size());
const size_t nPt = last_obs->rangeImage.cols() * y + x;
curVisibleFeats[(*itFeat)->ID] = TPoint3D(