diff --git a/0 b/0 new file mode 100644 index 00000000..e69de29b diff --git a/program/CMakeLists.txt b/program/CMakeLists.txt index 2a4cd941..61d2d438 100644 --- a/program/CMakeLists.txt +++ b/program/CMakeLists.txt @@ -30,6 +30,9 @@ INCLUDE_DIRECTORIES( FIND_PACKAGE(Threads REQUIRED) SET(PMVS_LIBRARIES ${PMVS_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +# OPTIONS +OPTION(CIMG_USE_OPENMP "Enable OpenMP parallelization in cimg" ON) + # Eigen SET( EIGEN3_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdParty/Eigen ) SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${EIGEN3_INCLUDE_DIR}/cmake" ) @@ -95,6 +98,30 @@ IF(PMVS_USE_TIFF) ENDIF(TIFF_FOUND) ENDIF(PMVS_USE_TIFF) +# OpenMP +# ============================================================================== +# OpenMP detection +# ============================================================================== +IF(CIMG_USE_OPENMP) + FIND_PACKAGE(OpenMP) + IF(OPENMP_FOUND) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + OPTION(CIMG_USE_OPENMP "Use OpenMP for parallelization in cimg" ON) + ADD_DEFINITIONS(-DCIMG_USE_OPENMP) + IF (NOT MSVC) + IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # for those using the clang with OpenMP support + LIST(APPEND OPENMVG_LIBRARY_DEPENDENCIES iomp) + ELSE() + LIST(APPEND OPENMVG_LIBRARY_DEPENDENCIES gomp) + ENDIF() + ENDIF(NOT MSVC) + ENDIF(OPENMP_FOUND) +ELSE(CIMG_USE_OPENMP) + OPTION(OpenMVG_USE_OPENMP "Use OpenMP for parallelization in cimg" OFF) + UPDATE_CACHE_VARIABLE(CIMG_USE_OPENMP OFF) + REMOVE_DEFINITIONS(-DCIMG_USE_OPENMP) +ENDIF(CIMG_USE_OPENMP) ADD_SUBDIRECTORY(base) ADD_SUBDIRECTORY(main) diff --git a/program/base/cmvs/bundle.cc b/program/base/cmvs/bundle.cc index 82f8c719..cf11a82d 100644 --- a/program/base/cmvs/bundle.cc +++ b/program/base/cmvs/bundle.cc @@ -59,9 +59,9 @@ void Cbundle::prep(const std::string prefix, const int imageThreshold, char buffer[1024]; sprintf(buffer, "%sbundle.rd.out", prefix.c_str()); - cerr << "Reading bundle..." << flush; + cout << "Reading bundle..." << flush; readBundle(buffer); - cerr << endl; + cout << endl; vector images; for (int c = 0; c < m_cnum; ++c) @@ -71,9 +71,9 @@ void Cbundle::prep(const std::string prefix, const int imageThreshold, m_maxLevel = 12; m_pss.init(images, prefix, m_maxLevel + 1, 5, 0); - cerr << "Set widths/heights..." << flush; + cout << "Set widths/heights..." << flush; setWidthsHeightsLevels(); - cerr << "done" << flush; + cout << "done" << flush; } void Cbundle::prep2(void) { @@ -83,40 +83,40 @@ void Cbundle::prep2(void) { m_sfms2.resize((int)m_coords.size()); startTimer(); setScoreThresholds(); - cerr << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; startTimer(); - cerr << "slimNeighborsSetLinks..." << flush; + cout << "slimNeighborsSetLinks..." << flush; slimNeighborsSetLinks(); - cerr << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; } // Improve visibility by using texture analysis startTimer(); - cerr << "mergeSFM..." << flush; + cout << "mergeSFM..." << flush; mergeSfMP(); - cerr << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; m_sfms2.clear(); m_sfms2.resize((int)m_coords.size()); - cerr << "setScoreThresholds..." << flush; + cout << "setScoreThresholds..." << flush; startTimer(); setScoreThresholds(); - cerr << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; // Remove redundant images first - cerr << "sRemoveImages... " << flush; + cout << "sRemoveImages... " << flush; startTimer(); sRemoveImages(); - cerr << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; // use m_removed to change m_visibles and update m_neighbors startTimer(); resetVisibles(); setNeighbors(); - cerr << "slimNeighborsSetLinks..." << flush; + cout << "slimNeighborsSetLinks..." << flush; slimNeighborsSetLinks(); - cerr << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; // Init m_timages by mutually exclusive clustering setTimages(); @@ -132,12 +132,12 @@ void Cbundle::run(const std::string prefix, const int imageThreshold, prep(prefix, imageThreshold, tau, scoreRatioThreshold, coverageThreshold, pnumThreshold, CPU); - cerr << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << '\t' << curTimer()/CLOCKS_PER_SEC << " secs" << endl; prep2(); // Assumed variables that must be set properly here - cerr << "Adding images: " << endl; + cout << "Adding images: " << endl; startTimer(); // Add images // Repeat until all the clusters become at most m_imageThreshold. @@ -170,7 +170,7 @@ void Cbundle::run(const std::string prefix, const int imageThreshold, if (change == 0) break; } - cerr << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; + cout << "done\t" << curTimer()/CLOCKS_PER_SEC << " secs" << endl; m_oimages.resize((int)m_timages.size()); @@ -265,28 +265,28 @@ void Cbundle::sRemoveImages(void) { const int tenth = max(1, m_cnum / 10); for (int i = 0; i < (int)vvi.size(); ++i) { if (i % tenth == 0) - cerr << '*' << flush; + cout << '*' << flush; const int image = vvi[i][1]; checkImage(image); } - cerr << endl; + cout << endl; - cerr << "Kept: "; + cout << "Kept: "; int kept = 0; for (int c = 0; c < m_cnum; ++c) if (m_removed[c] == 0) { ++kept; - cerr << c << ' '; + cout << c << ' '; } - cerr << endl << endl; + cout << endl << endl; - cerr << "Removed: "; + cout << "Removed: "; for (int c = 0; c < m_cnum; ++c) if (m_removed[c]) { - cerr << c << ' '; + cout << c << ' '; } - cerr << endl; - cerr << "sRemoveImages: " << m_cnum << " -> " << kept << flush; + cout << endl; + cout << "sRemoveImages: " << m_cnum << " -> " << kept << flush; } void Cbundle::resetVisibles(void) { @@ -448,10 +448,10 @@ void Cbundle::setTimages(void) { else divideImages(lhs, m_timages); - cerr << endl << "Cluster sizes: " << endl; + cout << endl << "Cluster sizes: " << endl; for (int i = 0; i < (int)m_timages.size(); ++i) - cerr << (int)m_timages[i].size() << ' '; - cerr << endl; + cout << (int)m_timages[i].size() << ' '; + cout << endl; } void Cbundle::divideImages(const std::vector& lhs, @@ -515,7 +515,7 @@ void Cbundle::divideImages(const std::vector& lhs, } if (cand1.empty() || cand2.empty()) { - cerr << "Error. Normalized cuts produced an empty cluster: " + cout << "Error. Normalized cuts produced an empty cluster: " << (int)part.size() << " -> " << (int)cand1.size() << ' ' << (int)cand2.size() << endl; @@ -558,7 +558,7 @@ void Cbundle::readBundle(const std::string file) { int cnum, pnum; ifstr >> cnum >> pnum; vector ids; ids.resize(cnum); - cerr << cnum << " cameras -- " << pnum << " points in bundle file" << endl; + cout << cnum << " cameras -- " << pnum << " points in bundle file" << endl; m_cnum = 0; for (int c = 0; c < cnum; ++c) { ids[c] = -1; @@ -577,7 +577,7 @@ void Cbundle::readBundle(const std::string file) { const int tenth = max(1, pnum / 10); for (int p = 0; p < pnum; ++p) { if (p % tenth == 0) - cerr << '*' << flush; + cout << '*' << flush; int num; Vec3f color; Vec4f coord; ifstr >> coord[0] >> coord[1] >> coord[2] @@ -621,7 +621,7 @@ void Cbundle::readBundle(const std::string file) { ifstr.close(); setNeighbors(); - cerr << endl << m_cnum << " cameras -- " << m_pnum << " points" << flush; + cout << endl << m_cnum << " cameras -- " << m_pnum << " points" << flush; } void Cbundle::findPNeighbors(sfcnn& tree, @@ -673,7 +673,7 @@ void Cbundle::mergeSfMPThread(void) { if (pid != -1 && m_merged[pid]) pid = -2; if (m_count % tenth == 0) - cerr << '*' << flush; + cout << '*' << flush; ++m_count; mtx_unlock(&m_lock); if (pid == -2) @@ -786,9 +786,9 @@ void Cbundle::mergeSfMP(void) { } // Based on m_puf, reset m_coords, m_coords, m_visibles, m_vpoints - cerr << "resetPoints..." << flush; + cout << "resetPoints..." << flush; resetPoints(); - cerr << "done" << endl; + cout << "done" << endl; delete m_puf; m_puf = NULL; @@ -796,7 +796,7 @@ void Cbundle::mergeSfMP(void) { m_ptree = NULL; const int npnum = (int)m_coords.size(); - cerr << "Rep counts: " << cpnum << " -> " << npnum << " " << flush; + cout << "Rep counts: " << cpnum << " -> " << npnum << " " << flush; } // Based on m_puf, reset m_coords, m_coords, m_visibles, m_vpoints @@ -998,8 +998,8 @@ void Cbundle::addImagesP(void) { } for (int i = 0; i < (int)m_addnums.size(); ++i) - cerr << m_addnums[i] << ' '; - cerr << endl; + cout << m_addnums[i] << ' '; + cout << endl; int totalnum = 0; for (int c = 0; c < (int)m_timages.size(); ++c) @@ -1009,7 +1009,7 @@ void Cbundle::addImagesP(void) { if (m_removed[c] == 0) ++beforenum; - cerr << "Image nums: " + cout << "Image nums: " << m_cnum << " -> " << beforenum << " -> " << totalnum << endl; } @@ -1389,7 +1389,7 @@ void Cbundle::writeVis(void) { ofstr.close(); - cerr << numer / (float)denom << " images in vis on the average" << endl; + cout << numer / (float)denom << " images in vis on the average" << endl; } diff --git a/program/base/image/photoSetS.cc b/program/base/image/photoSetS.cc index 9fb6717c..368e92b2 100644 --- a/program/base/image/photoSetS.cc +++ b/program/base/image/photoSetS.cc @@ -25,7 +25,7 @@ void CphotoSetS::init(const std::vector& images, const std::string prefix, m_prefix = prefix; m_maxLevel = max(1, maxLevel); m_photos.resize(m_num); - cerr << "Reading images: " << flush; + cout << "Reading images: " << flush; for (int index = 0; index < m_num; ++index) { const int image = m_images[index]; @@ -56,7 +56,7 @@ void CphotoSetS::init(const std::vector& images, const std::string prefix, m_photos[index].alloc(); else m_photos[index].alloc(1); - cerr << '*' << flush; + cout << '*' << flush; } // try 4 digits else { @@ -73,7 +73,7 @@ void CphotoSetS::init(const std::vector& images, const std::string prefix, m_photos[index].alloc(); else m_photos[index].alloc(1); - cerr << '*' << flush; + cout << '*' << flush; } /* @@ -91,10 +91,10 @@ void CphotoSetS::init(const std::vector& images, const std::string prefix, m_photos[index].alloc(); else m_photos[index].alloc(1); - cerr << '*' << flush; + cout << '*' << flush; */ } - cerr << endl; + cout << endl; const int margin = size / 2; m_size = 2 * margin + 1; } diff --git a/program/base/pmvs/detectFeatures.cc b/program/base/pmvs/detectFeatures.cc index 5c7012f4..abb86b40 100644 --- a/program/base/pmvs/detectFeatures.cc +++ b/program/base/pmvs/detectFeatures.cc @@ -39,7 +39,7 @@ void CdetectFeatures::run(const CphotoSetS& pss, const int num, for (int i = 0; i < m_CPU; ++i) thrd_join(threads[i], NULL); //---------------------------------------------------------------------- - cerr << "done" << endl; + cout << "done" << endl; } int CdetectFeatures::runThreadTmp(void* arg) { @@ -61,7 +61,7 @@ void CdetectFeatures::runThread(void) { break; const int image = m_ppss->m_images[index]; - cerr << image << ' ' << flush; + cout << image << ' ' << flush; //????????????? May need file lock, because targetting images //should not overlap among multiple processors. diff --git a/program/base/pmvs/dog.cc b/program/base/pmvs/dog.cc index cd133668..040d43c8 100644 --- a/program/base/pmvs/dog.cc +++ b/program/base/pmvs/dog.cc @@ -119,7 +119,7 @@ void Cdog::run(const std::vector& image, const float firstScale, // 1.4f const float lastScale, // 4.0f std::multiset & result) { - cerr << "DoG running..." << flush; + cout << "DoG running..." << flush; m_width = width; m_height = height; @@ -221,7 +221,7 @@ void Cdog::run(const std::vector& image, } } - cerr << (int)result.size() << " dog done" << endl; + cout << (int)result.size() << " dog done" << endl; } void Cdog::setRes(const float sigma, diff --git a/program/base/pmvs/expand.cc b/program/base/pmvs/expand.cc index 76d32554..3e86b325 100644 --- a/program/base/pmvs/expand.cc +++ b/program/base/pmvs/expand.cc @@ -43,24 +43,24 @@ void Cexpand::run(void) { // set queue m_fm.m_pos.collectPatches(m_queue); - cerr << "Expanding patches..." << flush; + cout << "Expanding patches..." << flush; vector threads(m_fm.m_CPU); for (int c = 0; c < m_fm.m_CPU; ++c) thrd_create(&threads[c], &expandThreadTmp, (void*)this); for (int c = 0; c < m_fm.m_CPU; ++c) thrd_join(threads[c], NULL); - cerr << endl + cout << endl << "---- EXPANSION: " << (time(NULL) - starttime) << " secs ----" << endl; const int trial = accumulate(m_ecounts.begin(), m_ecounts.end(), 0); const int fail0 = accumulate(m_fcounts0.begin(), m_fcounts0.end(), 0); const int fail1 = accumulate(m_fcounts1.begin(), m_fcounts1.end(), 0); const int pass = accumulate(m_pcounts.begin(), m_pcounts.end(), 0); - cerr << "Total pass fail0 fail1 refinepatch: " + cout << "Total pass fail0 fail1 refinepatch: " << trial << ' ' << pass << ' ' << fail0 << ' ' << fail1 << ' ' << pass + fail1 << endl; - cerr << "Total pass fail0 fail1 refinepatch: " + cout << "Total pass fail0 fail1 refinepatch: " << 100 * trial / (float)trial << ' ' << 100 * pass / (float)trial << ' ' << 100 * fail0 / (float)trial << ' ' diff --git a/program/base/pmvs/filter.cc b/program/base/pmvs/filter.cc index d2faeeb2..e4dcd6fd 100644 --- a/program/base/pmvs/filter.cc +++ b/program/base/pmvs/filter.cc @@ -36,14 +36,14 @@ void Cfilter::filterOutside(void) { time_t tv; time(&tv); time_t curtime = tv; - cerr << "FilterOutside" << endl; + cout << "FilterOutside" << endl; //??? notice (1) here to avoid removing m_fix=1 m_fm.m_pos.collectPatches(1); const int psize = (int)m_fm.m_pos.m_ppatches.size(); m_gains.resize(psize); - cerr << "mainbody: " << flush; + cout << "mainbody: " << flush; m_fm.m_count = 0; vector threads(m_fm.m_CPU); @@ -51,7 +51,7 @@ void Cfilter::filterOutside(void) { thrd_create(&threads[i], &filterOutsideThreadTmp, (void*)this); for (int i = 0; i < m_fm.m_CPU; ++i) thrd_join(threads[i], NULL); - cerr << endl; + cout << endl; // delete patches with positive m_gains int count = 0; @@ -76,10 +76,10 @@ void Cfilter::filterOutside(void) { ave /= denom; ave2 /= denom; ave2 = sqrt(max(0.0, ave2 - ave * ave)); - cerr << "Gain (ave/var): " << ave << ' ' << ave2 << endl; + cout << "Gain (ave/var): " << ave << ' ' << ave2 << endl; time(&tv); - cerr << (int)m_fm.m_pos.m_ppatches.size() << " -> " + cout << (int)m_fm.m_pos.m_ppatches.size() << " -> " << (int)m_fm.m_pos.m_ppatches.size() - count << " (" << 100 * ((int)m_fm.m_pos.m_ppatches.size() - count) / (float)m_fm.m_pos.m_ppatches.size() << "%)\t" << (tv - curtime) / CLOCKS_PER_SEC << " secs" << endl; @@ -216,7 +216,7 @@ void Cfilter::filterExact(void) { time_t tv; time(&tv); time_t curtime = tv; - cerr << "Filter Exact: " << flush; + cout << "Filter Exact: " << flush; //??? cannot use (1) because we use patch.m_id to set newimages,.... m_fm.m_pos.collectPatches(); @@ -234,7 +234,7 @@ void Cfilter::filterExact(void) { thrd_create(&threads0[i], &filterExactThreadTmp, (void*)this); for (int i = 0; i < m_fm.m_CPU; ++i) thrd_join(threads0[i], NULL); - cerr << endl; + cout << endl; //---------------------------------------------------------------------- for (int p = 0; p < psize; ++p) { @@ -291,7 +291,7 @@ void Cfilter::filterExact(void) { } } time(&tv); - cerr << (int)m_fm.m_pos.m_ppatches.size() << " -> " + cout << (int)m_fm.m_pos.m_ppatches.size() << " -> " << (int)m_fm.m_pos.m_ppatches.size() - count << " (" << 100 * ((int)m_fm.m_pos.m_ppatches.size() - count) / (float)m_fm.m_pos.m_ppatches.size() << "%)\t" << (tv - curtime) / CLOCKS_PER_SEC << " secs" << endl; @@ -312,7 +312,7 @@ void Cfilter::filterExactThread(void) { if (m_fm.m_tnum <= image) break; - cerr << '*' << flush; + cout << '*' << flush; const int& w = m_fm.m_pos.m_gwidths[image]; const int& h = m_fm.m_pos.m_gheights[image]; @@ -516,7 +516,7 @@ void Cfilter::filterNeighbor(const int times) { time_t tv; time(&tv); time_t curtime = tv; - cerr << "FilterNeighbor:\t" << flush; + cout << "FilterNeighbor:\t" << flush; //??? notice (1) to avoid removing m_fix=1 m_fm.m_pos.collectPatches(1); @@ -558,7 +558,7 @@ void Cfilter::filterNeighbor(const int times) { } } time(&tv); - cerr << (int)m_fm.m_pos.m_ppatches.size() << " -> " + cout << (int)m_fm.m_pos.m_ppatches.size() << " -> " << (int)m_fm.m_pos.m_ppatches.size() - count << " (" << 100 * ((int)m_fm.m_pos.m_ppatches.size() - count) / (float)m_fm.m_pos.m_ppatches.size() << "%)\t" << (tv - curtime) / CLOCKS_PER_SEC << " secs" << endl; @@ -571,7 +571,7 @@ void Cfilter::filterSmallGroups(void) { time_t tv; time(&tv); time_t curtime = tv; - cerr << "FilterGroups:\t" << flush; + cout << "FilterGroups:\t" << flush; m_fm.m_pos.collectPatches(); if (m_fm.m_pos.m_ppatches.empty()) return; @@ -619,7 +619,7 @@ void Cfilter::filterSmallGroups(void) { } const int threshold = max(20, psize / 10000); - cerr << threshold << endl; + cout << threshold << endl; bite = size.begin(); eite = size.end(); @@ -651,7 +651,7 @@ void Cfilter::filterSmallGroups(void) { ++bpatch; } time(&tv); - cerr << (int)m_fm.m_pos.m_ppatches.size() << " -> " + cout << (int)m_fm.m_pos.m_ppatches.size() << " -> " << (int)m_fm.m_pos.m_ppatches.size() - count << " (" << 100 * ((int)m_fm.m_pos.m_ppatches.size() - count) / (float)m_fm.m_pos.m_ppatches.size() << "%)\t" << (tv - curtime)/CLOCKS_PER_SEC << " secs" << endl; diff --git a/program/base/pmvs/findMatch.cc b/program/base/pmvs/findMatch.cc index 5f434432..2e803998 100644 --- a/program/base/pmvs/findMatch.cc +++ b/program/base/pmvs/findMatch.cc @@ -225,7 +225,7 @@ void CfindMatch::run(void) { ++m_depth; } time(&tv); - cerr << "---- Total: " << (tv - curtime)/CLOCKS_PER_SEC << " secs ----" << endl; + cout << "---- Total: " << (tv - curtime)/CLOCKS_PER_SEC << " secs ----" << endl; } void CfindMatch::write(const std::string prefix, bool bExportPLY, bool bExportPatch, bool bExportPSet) { diff --git a/program/base/pmvs/harris.cc b/program/base/pmvs/harris.cc index 4d68cc9a..ebd77637 100644 --- a/program/base/pmvs/harris.cc +++ b/program/base/pmvs/harris.cc @@ -166,7 +166,7 @@ void Charris::run(const std::vector& image, const int gspeedup, const float sigma, std::multiset & result) { - cerr << "Harris running ..." << flush; + cout << "Harris running ..." << flush; m_width = width; m_height = height; m_sigmaD = sigma; m_sigmaI = sigma; init(image, mask, edge); @@ -219,5 +219,5 @@ void Charris::run(const std::vector& image, } } - cerr << (int)result.size() << " harris done" << endl; + cout << (int)result.size() << " harris done" << endl; } diff --git a/program/base/pmvs/option.cc b/program/base/pmvs/option.cc index 8c9d1d80..fb6f5001 100644 --- a/program/base/pmvs/option.cc +++ b/program/base/pmvs/option.cc @@ -117,28 +117,28 @@ void Soption::init(const std::string prefix, const std::string option) { if (m_useBound) initBindexes(sbimages); - cerr << "--------------------------------------------------" << endl + cout << "--------------------------------------------------" << endl << "--- Summary of specified options ---" << endl; - cerr << "# of timages: " << (int)m_timages.size(); + cout << "# of timages: " << (int)m_timages.size(); if (m_tflag == -1) - cerr << " (range specification)" << endl; + cout << " (range specification)" << endl; else - cerr << " (enumeration)" << endl; - cerr << "# of oimages: " << (int)m_oimages.size(); + cout << " (enumeration)" << endl; + cout << "# of oimages: " << (int)m_oimages.size(); if (m_oflag == -1) - cerr << " (range specification)" << endl; + cout << " (range specification)" << endl; else if (0 <= m_oflag) - cerr << " (enumeration)" << endl; + cout << " (enumeration)" << endl; else if (m_oflag == -2) - cerr << " (vis.dat is used)" << endl; + cout << " (vis.dat is used)" << endl; else if (m_oflag == -3) - cerr << " (not used)" << endl; + cout << " (not used)" << endl; - cerr << "level: " << m_level << " csize: " << m_csize << endl + cout << "level: " << m_level << " csize: " << m_csize << endl << "threshold: " << m_threshold << " wsize: " << m_wsize << endl << "minImageNum: " << m_minImageNum << " CPU: " << m_CPU << endl << "useVisData: " << m_useVisData << " sequence: " << m_sequence << endl; - cerr << "--------------------------------------------------" << endl; + cout << "--------------------------------------------------" << endl; } void Soption::initOimages(void) { @@ -284,7 +284,7 @@ void Soption::initBindexes(const std::string sbimages) { exit (1); } - cerr << "Reading bimages" << endl; + cout << "Reading bimages" << endl; int itmp; ifstr >> itmp; for (int i = 0; i < itmp; ++i) { diff --git a/program/base/pmvs/patchOrganizerS.cc b/program/base/pmvs/patchOrganizerS.cc index dd11bcf6..0e82c613 100644 --- a/program/base/pmvs/patchOrganizerS.cc +++ b/program/base/pmvs/patchOrganizerS.cc @@ -132,7 +132,7 @@ void CpatchOrganizerS::readPatches(void) { string header; int pnum; ifstr >> header >> pnum; - cerr << image << ' ' << pnum << " patches" << endl; + cout << image << ' ' << pnum << " patches" << endl; for (int p = 0; p < pnum; ++p) { Ppatch ppatch(new Cpatch()); ifstr >> *ppatch; @@ -171,7 +171,7 @@ void CpatchOrganizerS::readPatches(void) { string header; int pnum; ifstr >> header >> pnum; - cerr << image << ' ' << pnum << " patches" << endl; + cout << image << ' ' << pnum << " patches" << endl; for (int p = 0; p < pnum; ++p) { Ppatch ppatch(new Cpatch()); diff --git a/program/base/pmvs/seed.cc b/program/base/pmvs/seed.cc index 65f827aa..cc78963a 100644 --- a/program/base/pmvs/seed.cc +++ b/program/base/pmvs/seed.cc @@ -58,7 +58,7 @@ void Cseed::run(void) { random_shuffle(vitmp.begin(), vitmp.end()); m_fm.m_jobs.insert(m_fm.m_jobs.end(), vitmp.begin(), vitmp.end()); - cerr << "adding seeds " << endl; + cout << "adding seeds " << endl; m_fm.m_pos.clearCounts(); @@ -79,18 +79,18 @@ void Cseed::run(void) { for (int i = 0; i < m_fm.m_CPU; ++i) thrd_join(threads[i], NULL); //---------------------------------------------------------------------- - cerr << "done" << endl; + cout << "done" << endl; time(&tv); - cerr << "---- Initial: " << (tv - curtime)/CLOCKS_PER_SEC << " secs ----" << endl; + cout << "---- Initial: " << (tv - curtime)/CLOCKS_PER_SEC << " secs ----" << endl; const int trial = accumulate(m_scounts.begin(), m_scounts.end(), 0); const int fail0 = accumulate(m_fcounts0.begin(), m_fcounts0.end(), 0); const int fail1 = accumulate(m_fcounts1.begin(), m_fcounts1.end(), 0); const int pass = accumulate(m_pcounts.begin(), m_pcounts.end(), 0); - cerr << "Total pass fail0 fail1 refinepatch: " + cout << "Total pass fail0 fail1 refinepatch: " << trial << ' ' << pass << ' ' << fail0 << ' ' << fail1 << ' ' << pass + fail1 << endl; - cerr << "Total pass fail0 fail1 refinepatch: " + cout << "Total pass fail0 fail1 refinepatch: " << 100 * trial / (float)trial << ' ' << 100 * pass / (float)trial << ' ' << 100 * fail0 / (float)trial << ' ' @@ -198,7 +198,7 @@ void Cseed::initialMatch(const int index, const int id) { } } } - cerr << '(' << index << ',' << totalcount << ')' << flush; + cout << '(' << index << ',' << totalcount << ')' << flush; } void Cseed::collectCells(const int index0, const int index1, diff --git a/program/main/cmvs.cc b/program/main/cmvs.cc index ca996ac1..22605bd9 100644 --- a/program/main/cmvs.cc +++ b/program/main/cmvs.cc @@ -8,7 +8,7 @@ using namespace std; int main(int argc, char* argv[]) { if (argc < 2) { - cerr << "Usage: " << argv[0] << " prefix maximage[=100] CPU[=4]" << endl + cout << "Usage: " << argv[0] << " prefix maximage[=100] CPU[=4]" << endl << endl << "You should choose maximage based on the amount of memory in your machine." << endl << "CPU should be the number of (virtual) CPUs or cores in your machine." << endl diff --git a/program/main/genOption.cc b/program/main/genOption.cc index 6ba24457..b0c4abe0 100644 --- a/program/main/genOption.cc +++ b/program/main/genOption.cc @@ -9,7 +9,7 @@ using namespace std; int main(int argc, char* argv[]) { if (argc < 2) { - cerr << "Usage: " << argv[0] + cout << "Usage: " << argv[0] << " prefix level[=1] csize[=2] threshold[=0.7] wsize[=7]" << " minImageNum[=3] CPU[=8]" << endl << endl diff --git a/program/main/pmvs2.cc b/program/main/pmvs2.cc index 5aa4b42f..49cda9d9 100644 --- a/program/main/pmvs2.cc +++ b/program/main/pmvs2.cc @@ -8,7 +8,7 @@ using namespace std; int main(int argc, char* argv[]) { if (argc < 3) { - cerr << "Usage: " << argv[0] << " prefix option_file [Optional export]" << endl + cout << "Usage: " << argv[0] << " prefix option_file [Optional export]" << endl << endl << "--------------------------------------------------" << endl << "level 1 csize 2" << endl