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


C++ Configure::getConfString方法代码示例

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


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

示例1: calibrateProcess

void calibrateProcess(Configure& conf, cv::Mat& cameraMatrix, cv::Mat& distCoeffs)
{
    const cv::Size frameSize(conf.getConfInt("universal.frameWidth"),
                             conf.getConfInt("universal.frameHeight"));
    const cv::string dataPath(conf.getConfString("universal.dataPath"));
    
    const std::string checkerPrefix
        (conf.getConfString("calibration.checkerPrefix"));
    const std::string checkerSuffix
        (conf.getConfString("calibration.checkerSuffix"));
    const int checkerNum = conf.getConfInt("calibration.checkerNum");
    const cv::Size checkerSize(conf.getConfInt("calibration.checkerWidth"),
                               conf.getConfInt("calibration.checkerHeight"));
    
    cv::vector<cv::Mat> checkerImgs;
    cv::vector<cv::vector<cv::Point3f>> worldPoints(checkerNum);
    cv::vector<cv::vector<cv::Point2f>> imagePoints(checkerNum);
    
    cv::TermCriteria criteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS, 20, 0.001);
    
    cv::vector<cv::Mat> rotationVectors;
    cv::vector<cv::Mat> translationVectors;
    
    for(int i=0; i<checkerNum; i++){
        std::stringstream stream;
        stream << checkerPrefix << i+1 << checkerSuffix;
        std::string fileName = stream.str();
        cv::Mat tmp = cv::imread(dataPath + fileName, 0);
        cv::resize(tmp, tmp, frameSize);
        checkerImgs.push_back(tmp);
        std::cout << "load checker image: " << fileName << std::endl;
    }
    
    cv::namedWindow("Source", CV_WINDOW_AUTOSIZE|CV_WINDOW_FREERATIO);
    for(int i=0; i<checkerNum; i++){
        std::cout << "find corners from image " << i+1;
        if(cv::findChessboardCorners(checkerImgs[i], checkerSize,
                                     imagePoints[i])){
            std::cout << " ... all corners found." << std::endl;
            cv::cornerSubPix(checkerImgs[i], imagePoints[i], cv::Size(5, 5),
                             cv::Size(-1, -1), criteria);
            cv::drawChessboardCorners(checkerImgs[i], checkerSize,
                                      (cv::Mat)(imagePoints[i]), true);
            cv::imshow("Source", checkerImgs[i]);
            cv::waitKey(200);
        }else{
            std::cout << " ... at least 1 corner not found." << std::endl;
            cv::waitKey(0);
            exit(-1);
        }
    }
    cv::destroyWindow("Source");
    
    for(int i=0; i<checkerNum; i++){
        for(int j=0; j<checkerSize.area(); j++){
            worldPoints[i].
                push_back(cv::Point3f(static_cast<float>(j%checkerSize.width*10),
                                      static_cast<float>(j/checkerSize.width*10),
                                      0.0));
        }
    }
    
    cv::calibrateCamera(worldPoints, imagePoints, frameSize, cameraMatrix,
                        distCoeffs, rotationVectors, translationVectors);
    
    std::cout << "camera matrix" << std::endl;
    std::cout << cameraMatrix << std::endl;
    std::cout << "dist coeffs" << std::endl;
    std::cout << distCoeffs << std::endl;
    
}
开发者ID:nakazawa9892,项目名称:AxisOfRotation,代码行数:71,代码来源:process.cpp


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