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


C++ FileList::AddData方法代码示例

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


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

示例1: CorrespondGroundTruths

void KinectDatasetReader::CorrespondGroundTruths()
{
    // Ground truth data frequency can be higher than the kinect frequency
    size_t iCurrGtIndex = 0, iCurrRGBDIndex = 0;

    //NOTE: This only checks time frame for rgb image, and time stamp of depth image
    //      is not considered.
    double rgbTime, gtTime;

    std::vector<std::pair<size_t, size_t> > detectedPairs;

    int loopCount = 0;
    while( iCurrRGBDIndex < mRGBFiles.TimeStamps.size() &&
            iCurrGtIndex < mGroundTruth.size() )
    {
        gtTime = mGroundTruth[iCurrGtIndex].TimeStamp;
        rgbTime = mRGBFiles.TimeStamps[iCurrRGBDIndex];

        if( IsNear(gtTime - rgbTime) )
        {
            double currGTTime = gtTime;
            double mindt = fabs(currGTTime - rgbTime);
            size_t minIndex = iCurrGtIndex;
            size_t index = iCurrGtIndex;

            while( index < mGroundTruth.size() )
            {
                currGTTime = mGroundTruth[index].TimeStamp;
                double dt = fabs(currGTTime - rgbTime);
                if( IsNear(dt) )
                {
                    if( dt < mindt )
                    {
                        minIndex = index;
                        mindt = dt;
                    }
                    index++;
                }
                else
                    break;
            }

            iCurrGtIndex = minIndex; // set it as minimum distance in time
            detectedPairs.push_back(make_pair(iCurrRGBDIndex, iCurrGtIndex));
            iCurrGtIndex++;
            iCurrRGBDIndex++;
        }
        else if( gtTime < rgbTime )
        {
            iCurrGtIndex++;
        }
        else
        {
            iCurrRGBDIndex++;
        }
        loopCount++;
    }

    // I dont have time to optimize this code, should be done by using list instead of vector. probably!
    GroundTruthArray gtInfoList;
    FileList rgb;
    FileList dp;

    for(size_t i = 0; i < detectedPairs.size(); i++)
    {
        size_t rgbdIndex = detectedPairs[i].first;
        size_t gtIndex = detectedPairs[i].second;
        gtInfoList.push_back(mGroundTruth[gtIndex]);
        rgb.AddData(mRGBFiles.TimeStamps[rgbdIndex], mRGBFiles.FileNames[rgbdIndex]);
        dp.AddData(mDepthFiles.TimeStamps[rgbdIndex], mDepthFiles.FileNames[rgbdIndex]);
    }

    mGroundTruth = gtInfoList;
    mRGBFiles = rgb;
    mDepthFiles = dp;
}
开发者ID:kouroshs,项目名称:ksrobot,代码行数:76,代码来源:KinectDatasetReader.cpp


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