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


C++ ProgressBar::print方法代码示例

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


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

示例1: Train


//.........这里部分代码省略.........
        
/* ------------------------------------------- FIND THRESHOLD VALUE -------------------------------------- */
        
    Optimalthreshold* optimalThreshold = new Optimalthreshold(openingFilter -> GetOutput());
    //Optimalthreshold* optimalThreshold = new Optimalthreshold(grayscaleFilter -> GetOutput());
    limitValue = optimalThreshold -> GetOutput();
    //cout << "Valor Limiar : " << limitValue << endl;
    ThresholdFilter::Pointer thresholdFilter = ThresholdFilter::New();
    thresholdFilter -> SetInput(grayscaleFilter -> GetOutput());
    thresholdFilter -> SetOutsideValue(255);
    thresholdFilter -> SetUpper(optimalThreshold -> GetOutput()); // valor aleatorio
    thresholdFilter -> SetLower(0);
    thresholdFilter -> Update();
    GrayscaleImageType::Pointer thresholdImage = GrayscaleImageType::New();
    thresholdImage = thresholdFilter -> GetOutput();
    thresholdImage -> Update();
        
/* ------------------------------------------------------------------------------------------------------ */
            
/* ---------------------------------------- REGION GROWING ---------------------------------------------- */
            
    NeighborhoodConnectedFilterType::Pointer regionGrow = NeighborhoodConnectedFilterType::New();
    float lower = 0;
    float upper = optimalThreshold -> GetOutput();
    regionGrow->SetLower(lower);
    regionGrow->SetUpper(upper);
    regionGrow->SetReplaceValue(255);
    regionGrow->SetInput(grayscaleFilter -> GetOutput());
            
    for (int x = 5; x < 250; x += 5) {
        GrayscaleImageType::IndexType seed1;
        seed1[0] = x;
        seed1[1] = 0;
        regionGrow->AddSeed(seed1);
        GrayscaleImageType::IndexType seed2;
        seed2[0] = x;
        seed2[1] = 255;
        regionGrow->AddSeed(seed2);
    }
    for (int y = 0; y < 250; y += 5) {
        GrayscaleImageType::IndexType seed1;
        seed1[0] = 255;
        seed1[1] = y;
        regionGrow->AddSeed(seed1);
        GrayscaleImageType::IndexType seed2;
        seed2[0] = 0;
        seed2[1] = y;
        regionGrow->AddSeed(seed2);
    }
            
/* ------------------------------------------------------------------------------------------------------ */
            
/* --------------------------------------------- OR IMAGEFILTER ----------------------------------------- */
            
    OrFilterType::Pointer orFilter = OrFilterType::New();
    orFilter -> SetInput(0, thresholdImage);
    orFilter -> SetInput(1, regionGrow -> GetOutput());
    orFilter -> Update();
        
/* ------------------------------------------------------------------------------------------------------- */
            
/* --------------------------------------------- DATA COLLECT -------------------------------------------- */
        
    //DataCollector* dataCollector = new DataCollector(dilateFilter -> GetOutput());
    DataCollector* dataCollector = new DataCollector(orFilter -> GetOutput());
        
        
/* ------------------------------------------------------------------------------------------------------- */
            
/* ------------------------------------------ GENERATE RESULTS ------------------------------------------- *
        
        stringstream imageOut;
        imageOut << "out/" << fileHandler -> GetFiles()[cont].substr(dirName.length() , (fileHandler -> GetFiles()[cont].length() - dirName.length()));
        cout  << "imageName : " << imageOut.str() << endl;
        cout << "==============================================================================" << endl << endl;
        WriterType::Pointer writer = WriterType::New();
        writer -> SetFileName(imageOut.str());
        writer -> SetInput(orFilter -> GetOutput());
        writer -> Update();
            
/* ------------------------------------------------------------------------------------------------------- */
        if(dataCollector -> GetPxCount() == 0){
            //fprintf(resultFile,"%d , %d , %d , %d\n",limitValue * 2 , dataCollector -> GetPxCount() , dataCollector -> GetCellAvrage() , label);
            fprintf(resultFile,"%d , %d , %d , %d\n",limitValue * 2 , dataCollector -> GetCellAvrage() , dataCollector -> GetAberration() , label);
        }else{
            //fprintf(resultFile,"%d , %d , %d , %d\n",limitValue , dataCollector -> GetPxCount() / 100 , dataCollector -> GetCellAvrage() , label);
            fprintf(resultFile,"%d , %d , %d , %d\n",limitValue , dataCollector -> GetCellAvrage() , dataCollector -> GetAberration() , label);
        }
        //cout << "tot : " << fileHandler -> GetNumberOfFiles() << " | inc : " <<  (100 / (float) fileHandler -> GetNumberOfFiles()) << endl;
        progressBar.update(100 / (float) fileHandler -> GetNumberOfFiles());
        progressBar.print();
        //cout << "Processado  " << cont + 1 << " de " << fileHandler -> GetNumberOfFiles() << endl;
    }
    fclose(resultFile);
    
/* -------------------------------------------------------------------------------------------------------- */
    
        cout << "TREINAMENTO CONCLUIDO" << endl;

}
开发者ID:joaofelipe1294,项目名称:ProjetoIBM,代码行数:101,代码来源:TrainPipeline.cpp


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