本文整理汇总了C++中KeyframeVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyframeVector::push_back方法的具体用法?C++ KeyframeVector::push_back怎么用?C++ KeyframeVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyframeVector
的用法示例。
在下文中一共展示了KeyframeVector::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadKeyframes
bool loadKeyframes(
KeyframeVector& keyframes,
const std::string& path)
{
keyframes.clear();
int kf_idx = 0;
while(true)
{
std::stringstream ss_idx;
ss_idx << std::setw(4) << std::setfill('0') << kf_idx;
std::string path_kf = path + "/" + ss_idx.str();
if (boost::filesystem::exists(path_kf))
{
ROS_INFO("Loading %s", path_kf.c_str());
RGBDKeyframe keyframe;
bool result_load = RGBDKeyframe::load(keyframe, path_kf);
if (result_load) keyframes.push_back(keyframe);
else
{
ROS_WARN("Error loading");
return false;
}
}
else return true;
kf_idx++;
}
}
示例2:
KeyframeEffectModelBase::KeyframeVector
KeyframeEffectModelBase::normalizedKeyframes(const KeyframeVector& keyframes) {
double lastOffset = 0;
KeyframeVector result;
result.reserveCapacity(keyframes.size());
for (const auto& keyframe : keyframes) {
double offset = keyframe->offset();
if (!isNull(offset)) {
DCHECK_GE(offset, 0);
DCHECK_LE(offset, 1);
DCHECK_GE(offset, lastOffset);
lastOffset = offset;
}
result.push_back(keyframe->clone());
}
if (result.isEmpty())
return result;
if (isNull(result.back()->offset()))
result.back()->setOffset(1);
if (result.size() > 1 && isNull(result[0]->offset()))
result.front()->setOffset(0);
size_t lastIndex = 0;
lastOffset = result.front()->offset();
for (size_t i = 1; i < result.size(); ++i) {
double offset = result[i]->offset();
if (!isNull(offset)) {
for (size_t j = 1; j < i - lastIndex; ++j)
result[lastIndex + j]->setOffset(
lastOffset + (offset - lastOffset) * j / (i - lastIndex));
lastIndex = i;
lastOffset = offset;
}
}
return result;
}