int main (int argc, char *argv[]) { using namespace std; using namespace alize; try { Config config; CmdLine cmdLine (argc, argv); if (cmdLine.displayHelpRequired ()) // --help { cout << "ExtractParams" << endl; cout << "ExtractParams.exe --i <inputFile> --featureServerMask <0-m,m+1-N> --saveFeatureFileExtension .red.prm" << endl; } else if (cmdLine.displayVersionRequired ()) // --version cout << "Version 0.0" << endl; else { cmdLine.copyIntoConfig (config); if (config.getParamCount() == 0) {cerr << "Error: Type ExtractParams.exe --help to get usage" << endl;exit(1);} config.setParam("featureServerBufferSize","1"); config.setParam("saveFeatureFileFormat",config.getParam("loadFeatureFileFormat")); ExtractParams (config); } } catch (alize::Exception & e) { cout << e.toString () << endl; } return 0; }
int main(int argc, char **argv) { CmdLine clp; parse_cmd_line(argc, argv, clp); TBSYS_LOGGER.rotateLog("multi_write.log"); TBSYS_LOGGER.setFileName("multi_write.log"); TBSYS_LOGGER.setLogLevel("info"); clp.log_all(); ob_init_memory_pool(); ObSchemaManager schema_mgr; if (NULL != clp.schema_file) { tbsys::CConfig config; if (!schema_mgr.parse_from_file(clp.schema_file, config)) { TBSYS_LOG(WARN, "parse schema fail"); exit(-1); } } else if (OB_SUCCESS != fetch_schema(clp.root_addr, clp.root_port, schema_mgr)) { TBSYS_LOG(WARN, "fetch schema fail"); exit(-1); } schema_mgr.print_info(); MutatorBuilder mb; mb.init(schema_mgr, clp.prefix_start, clp.suffix_length, clp.merge_addr, clp.merge_port, clp.table_start_version, clp.max_cell, clp.max_row, clp.max_suffix); if (OB_SUCCESS != mb.init_prefix_end(clp.prefix_end)) { TBSYS_LOG(WARN, "init prerfix end fail"); exit(-1); } ObServer dst_host; dst_host.set_ipv4_addr(clp.serv_addr, clp.serv_port); MockClient client; client.init(dst_host); for (int64_t i = 0; i < clp.mutator_num; i++) { ObMutator mutator; PageArena<char> allocer; int ret = OB_SUCCESS; if (OB_SUCCESS != (ret = mb.build_mutator(mutator, allocer, clp.using_id))) { TBSYS_LOG(WARN, "build_mutator fail ret=%d\n", ret); break; } int64_t timeu = tbsys::CTimeUtil::getTime(); ret = client.ups_apply(mutator, TIMEOUT_MS); TBSYS_LOG(INFO, "apply ret=%d timeu=%ld\n", ret, tbsys::CTimeUtil::getTime() - timeu); } client.destroy(); }
// --------------------------------------------------------------------------------// // MAIN // // --------------------------------------------------------------------------------// int main(int argc, char* argv[]) { // process command-line arguments CmdLine *cmdLine = InitCmdLine(); int next_arg = cmdLine->Read(argv,argc); if (HELP) { cmdLine->Usage("key-expand <STDIN>|FILE"); exit(1); } MESSAGES(VERBOSE); char *INPUT = next_arg==argc ? NULL : argv[next_arg]; // process FileBufferText buffer(INPUT); for (long int r=0; buffer.Next()!=NULL; r++) { char *inp = buffer.Get(); char *key = GetNextToken(&inp," \t"); while (inp[0]!=0) { char *val = GetNextToken(&inp," \t"); printf("%s\t%s\n", key, val); } } // cleanup delete cmdLine; return 0; }
int main(int argc, char *argv[]) { CmdLine cmd; std::string input_image; cmd.add(make_option('i', input_image, "imagefile")); try{ if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch (const std::string &s){ std::cerr << "Usage: " << argv[0] << ' ' << "[-i|--imagefile path] " << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } std::cout << "You called: " << std::endl << argv[0] << std::endl << "--imagefile " << input_image << std::endl; fblib::image::EXIFSimple exif_sample; exif_sample.open(input_image); std::cout << "width : " << exif_sample.getWidth() << std::endl; std::cout << "height : " << exif_sample.getHeight() << std::endl; std::cout << "focal : " << exif_sample.getFocalLength() << std::endl; std::cout << "brand : " << exif_sample.getBrand() << std::endl; std::cout << "model : " << exif_sample.getModel() << std::endl; getchar(); return EXIT_SUCCESS; }
void onSetSvnPath(CmdLine& cmdLine) { std::wstring path = cmdLine.next(); if(path.empty()) JStd::CmdLine::throwUsage(L"<new svn path> [remote name]"); string remote = GitSvn::wtoa(cmdLine.next()); if(remote.empty()) remote = "svn"; remote = GitSvn::toRef(remote, GitSvn::eRT_meta); //Git::CRepo gitRepo(L".\"); Git::CRepo gitRepo; GitSvn::openCur(gitRepo); Git::VectorCommit parents; parents.push_back(std::tr1::shared_ptr<Git::CCommit>(new Git::CCommit(gitRepo, gitRepo.GetRef(remote.c_str()).Oid()))); Git::CTree tree(gitRepo, parents.front()->Tree()); std::string commitMsg = GitSvn::wtoa(L"SvnPath: " + path); Git::CSignature sig(gitRepo); gitRepo.Commit(remote.c_str(), sig, sig, commitMsg.c_str(), tree, parents); cout << "SVN path set to " << GitSvn::wtoa(path) << endl; }
int main(int argc, char *argv[]) { CmdLine cmd; std::string first_frame_name; std::string second_frame_name; std::string third_frame_name; cmd.add(make_option('f', first_frame_name, "firstname")); cmd.add(make_option('s', second_frame_name, "secondname")); cmd.add(make_option('t', third_frame_name, "thirdname")); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch (const std::string& s) { std::cerr << "Feature detector \nUsage: " << argv[0] << "\n" << "[-f|--firstname name]\n" << "[-s|--secondname name]\n" << "[-t|--thirdname name]\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } cv::Mat first_img(cv::imread(first_frame_name, 0)); cv::Mat second_img(cv::imread(second_frame_name, 0)); cv::Mat third_img(cv::imread(third_frame_name, 0)); assert(first_img.type() == CV_8UC1 && !first_img.empty()); assert(second_img.type() == CV_8UC1 && !second_img.empty()); assert(third_img.type() == CV_8UC1 && !third_img.empty()); AbstractCamera* cam = new PinholeCamera(752, 480, 315.5, 315.5, 376.0, 240.0); FramePtr fisrt_frame(new Frame(cam, first_img, 0.0)); FramePtr second_frame(new Frame(cam, second_img, 1.0)); FramePtr third_frame(new Frame(cam, third_img, 1.0)); Initialization init; init.addFirstFrame(fisrt_frame); init.addSecondFrame(second_frame); third_frame->T_f_w_ = second_frame->T_f_w_; SparseImgAlign img_align(4, 1, 30, SparseImgAlign::GaussNewton, false, false); size_t img_align_n_tracked = img_align.run(second_frame, third_frame); std::cout << "Img Align:\t Tracked = " << img_align_n_tracked << std::endl; mvo::Map map; fisrt_frame->setKeyframe(); second_frame->setKeyframe(); map.addKeyframe(fisrt_frame); map.addKeyframe(second_frame); Reprojector reprojector(cam,map); std::vector< std::pair<FramePtr, size_t> > overlap_kfs; reprojector.reprojectMap(third_frame, overlap_kfs); const size_t repr_n_new_references = reprojector.n_matches_; const size_t repr_n_mps = reprojector.n_trials_; std::cout << "Reprojection:\t Points = " << repr_n_mps << "\t \t Matches = " << repr_n_new_references<<std::endl; getchar(); return 0; }
//! //! Run given commands synchronously. Treat each command-line argument as //! one command to be run in the debuggee's context. Invoke echoReq() when //! a command has just been sent successfully. Invoke onRsp() when some //! response is received. Invoke onTimeout() when timeout occurs waiting //! for a response. If rspCopies is non-zero, save responses there upon return. //! If Return true if successful. Return false if timed out. //! bool CmdAgent::runCmds(const CmdLine& cmdLine, StringVec* rspCopies) { if (rspCopies != 0) { rspCopies->reset(); } bool ok = true; unsigned int numArgs = cmdLine.numArgs(); if (numArgs > 1) { String s; String* rspCopy = (rspCopies == 0)? (0): (&s); for (unsigned int i = 1; (i < numArgs) && ok; ++i) { flush(); const String* req = cmdLine.arg(i); unsigned int timeoutInMsecs = UdpClient::ETERNITY; ok = io_->snd(req->raw(), req->byteSize(), dbuggee_, timeoutInMsecs); if (ok) { rspTail_ = 0; echoReq(*req); ok = showRsp(rspCopy); if (rspCopy != 0) { rspCopies->add(*rspCopy); } } } } return ok; }
// // Create socket to serve as channel for command inputs/outputs. // void CmdAgent::mkIo(const CmdLine& config) { String optK("ibufsize"); int ibufSize = S32(config.opt(optK), IBUF_SIZE /*defaultV*/); optK = "obufsize"; int obufSize = S32(config.opt(optK), OBUF_SIZE /*defaultV*/); io_ = new UdpClient(ibufSize, obufSize); }
//! //! Reset instance with given command line. Three options can be specified in //! the command line: capconfig, capfilter, and capname. The capconfig option is a //! colon-delimited string containing the following parameters: agentstacksize, //! bepromiscuous, bufsize, capicpkts, caplength, capogpkts, and looptimeout. The //! default capconfig option is: "131072:true:0x1000000:true:1518:true:300". The //! capfilter option is a string containing a pcap-format filter. The default //! capfilter option is an empty string. The capname option allows free-format //! naming of network traffic captures. The default capname option is an empty //! string. //! void CapConfig::reset(const CmdLine& cmdLine) { delete[] filter_; bool useDefaults = true; const String* defaultV = 0; String optK("capconfig"); const String* optV = cmdLine.opt(optK, defaultV); if (optV != 0) { bool makeCopy = false; char delim = ':'; DelimitedTxt txt(*optV, makeCopy, delim); int growBy = 0; unsigned int capacity = 7 + 1; bool trimLines = true; StringVec vec(txt, trimLines, capacity, growBy); if (vec.numItems() == 7) { agentStackSize_ = U32(&vec[0], AGENT_STACK_SIZE /*defaultV*/); bePromiscuous_ = Bool(&vec[1], true /*defaultV*/); bufSize_ = S32(&vec[2], BUF_SIZE /*defaultV*/); capIcPkts_ = Bool(&vec[3], true /*defaultV*/); capLength_ = S32::isValid(vec[4].ascii(), CAP_LENGTH_MIN, CAP_LENGTH_MAX)? S32(vec[4]): CAP_LENGTH; capOgPkts_ = Bool(&vec[5], true /*defaultV*/); loopTimeout_ = S32(&vec[6], LOOP_TIMEOUT /*defaultV*/); size_t size = 1; char* s = new char[size]; s[0] = 0; filter_ = s; useDefaults = false; name_.reset(); } } if (useDefaults) { filter_ = 0; reset(); } optK = "capfilter"; optV = cmdLine.opt(optK, defaultV); if (optV != 0) { size_t size = optV->byteSize(); char* s = new char[size]; memcpy(s, optV->raw(), size); delete[] filter_; filter_ = s; } optK = "capname"; name_ = *cmdLine.opt(optK, &name_); }
//-----Usage---------- // void Usage() { int n_methods = 4; char METHODS[][20] = { "-permute", "-resample", "-number", "" }; for (int i=0; i<n_methods; i++) { CmdLine *cmd = InitCmdLine(METHODS[i]); char s[1000]; sprintf(s, "rows %s [OPTIONS] <ROWS>", METHODS[i]); cmd->Usage(s); delete cmd; } }
int main( int argc , char ** argv ) { CmdLine cmd; std::string sSfM_Data_Filename; std::string sOutDir = ""; cmd.add( make_option( 'i', sSfM_Data_Filename, "sfmdata" ) ); cmd.add( make_option( 'o', sOutDir, "outdir" ) ); std::cout << "Note: this program writes output in Colmap file format.\n"; try { if ( argc == 1 ) { throw std::string( "Invalid command line parameter." ); } cmd.process( argc, argv ); } catch ( const std::string& s ) { std::cerr << "Usage: " << argv[0] << '\n' << "[-i|--sfmdata] filename, the SfM_Data file to convert\n" << "[-o|--outdir] path where cameras.txt, images.txt and points3D.txt will be saved\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } if ( !stlplus::folder_exists( sOutDir ) ) { stlplus::folder_create( sOutDir ); } // Read the input SfM scene SfM_Data sfm_data; if ( !Load( sfm_data, sSfM_Data_Filename, ESfM_Data( ALL ) ) ) { std::cerr << std::endl << "The input SfM_Data file \"" << sSfM_Data_Filename << "\" cannot be read." << std::endl; return EXIT_FAILURE; } if ( ! exportToColmap( sfm_data , sOutDir ) ) { std::cerr << "There was an error during export of the file" << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }
void onClone(CmdLine& cmdLine) { std::wstring gitPath = cmdLine.next(); std::wstring svnPath = cmdLine.next(); if(gitPath.empty() || svnPath.empty()) JStd::CmdLine::throwUsage(L"<git repo path> <svn repo path> [remote name]"); std::string remoteName = JStd::String::ToMult(cmdLine.next(), CP_UTF8); if(remoteName.empty()) remoteName = "svn"; SvnToGitSync(gitPath.c_str(), JStd::String::ToMult(svnPath.c_str(), CP_UTF8).c_str(), remoteName.c_str()); }
// Convert from a SfM_Data format to another int main(int argc, char **argv) { CmdLine cmd; std::string sSfM_Data_Filename_In, sOutputPLY_Out; cmd.add(make_option('i', sSfM_Data_Filename_In, "input_file")); cmd.add(make_option('o', sOutputPLY_Out, "output_file")); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch(const std::string& s) { std::cerr << "Usage: " << argv[0] << '\n' << "[-i|--input_file] path to the input SfM_Data scene\n" << "[-o|--output_file] path to the output PLY file\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } // Load input SfM_Data scene SfM_Data sfm_data; if (!Load(sfm_data, sSfM_Data_Filename_In, ESfM_Data(ALL))) { std::cerr << std::endl << "The input SfM_Data file \"" << sSfM_Data_Filename_In << "\" cannot be read." << std::endl; return EXIT_FAILURE; } // Compute the scene structure color std::vector<Vec3> vec_3dPoints, vec_tracksColor, vec_camPosition; ColorizeTracks(sfm_data, vec_3dPoints, vec_tracksColor); GetCameraPositions(sfm_data, vec_camPosition); // Export the SfM_Data scene in the expected format if (plyHelper::exportToPly(vec_3dPoints, vec_camPosition, sOutputPLY_Out, &vec_tracksColor)) { return EXIT_SUCCESS; } else { return EXIT_FAILURE; } }
// // env [--expandEnv] // bool MiscDbugCmd::doEnv(const CmdLine& req) { wchar_t* envW = GetEnvironmentStringsW(); StringVec env; String optK("expandEnv"); bool expandEnv = Bool(req.opt(optK), false /*defaultV*/); DelimitedTxt txt(EQUALS_SIGN); String k; String kv; String v; for (const wchar_t* w = envW; *w;) { kv = w; txt.setTxt(kv, false /*makeCopy*/); (txt.next(k, true /*doTrimLine*/) && getenv(k, v, expandEnv))? env.add(k + EQUALS_SIGN + v): env.add(kv); size_t n = wcslen(w); w += n + 1; } FreeEnvironmentStringsW(envW); env.sort(); String rsp(env.stringify(NEW_LINE)); respond(req, rsp); bool cmdIsValid = true; return cmdIsValid; }
// // Bind debugger socket. Use port address specified by the debugger option if // available. Use given default address otherwise. // void CmdAgent::bind(const CmdLine& config, unsigned int defaultAddr) { // Use default dbugger address. unsigned short port = 0U; dbugger_.reset(defaultAddr, port); // Use specified dbugger address. String optK("dbugger"); const String* dbugger = config.opt(optK, 0 /*defaultV*/); if (dbugger != 0) { bool portIsOptional = true; char delim = COLON; dbugger_.reset(dbugger->ascii(), delim, portIsOptional); } // Bind dbugger socket. // Consider port binding optional. bool ok = io_->bind(dbugger_.addr(), dbugger_.port()); if ((!ok) && (dbugger_.port() != 0)) { io_->bind(dbugger_.addr(), port); } // Save effective dbugger address. io_->getMyAddr(dbugger_); }
int main( int argc , char *argv[] ) { CmdLine cmd ; cmd.setBOption("write log",false); DiskXFile::setBigEndianMode() ; processCmdLine( &cmd , argc , argv ) ; LexiconInfo lex_info( am_models_fname , am_sil_phone , am_pause_phone , lex_dict_fname , lex_sent_start_word , lex_sent_end_word , lex_sil_word ) ; PhoneModels phone_models ( lex_info.phone_info , am_models_fname , true , am_phone_del_pen , am_apply_pause_del_pen , "" , "" , 9 , "" , false , (real)0.005 , (real)0.005 ) ; LinearLexicon lexicon( &lex_info , &phone_models ) ; LanguageModel *lang_model ; if ( lm_ngram_order <= 0 ) lang_model = NULL ; else { lang_model = new LanguageModel( 2 , lex_info.vocabulary , lm_fname, lm_scaling_factor ) ; } BeamSearchDecoder bs_decoder( &lexicon , lang_model , dec_word_entr_pen , dec_int_prune_window , dec_end_prune_window , dec_delayed_lm , dec_verbose ) ; MlDecoderPage batch_tester( input_fname , wrdtrns_fname , &bs_decoder , true , true , output_fname ) ; batch_tester.setOutputOptions( print_by_page, print_by_part, print_by_book ); batch_tester.run() ; printf( SUCCESS ); return(0) ; }
// // Populate given address range with given command-line arguments. // Assume command-line arguments, if any, are address ranges. Return // true if successful. // bool MiscDbugCmd::getAddrRange(const CmdLine& req, IpAddrSet& addrRange) { addrRange.reset(); size_t numArgs = req.numArgs(); for (size_t i = 1; i < numArgs; ++i) { const String* arg = req.arg(i); char delim = ','; if (!IpAddrSet::isValid(arg->ascii(), delim)) { addrRange.reset(); break; } addrRange.add(arg->ascii(), delim); } bool ok = (addrRange.numAddrs() > 0); return ok; }
int main(int argc, char *argv[]) { CmdLine cmd; std::string img_name; cmd.add(make_option('i', img_name, "imgname")); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch (const std::string& s) { std::cerr << "Feature detector \nUsage: " << argv[0] << "\n" << "[-i|--imgname name]\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } cv::Mat img(cv::imread(img_name, 0)); assert(img.type() == CV_8UC1 && !img.empty()); AbstractCamera* cam = new PinholeCamera(752, 480, 315.5, 315.5, 376.0, 240.0); FramePtr frame(new Frame(cam, img, 0.0)); Features fts; FastDetector fast_detector(img.cols, img.rows, 25, 3); Timer t; for (int i = 0; i < 100; ++i) { fast_detector.detect(frame.get(), frame->img_pyr_, 20.0, fts); } printf("Fast corner detection took %f ms, %d corners detected (ref i7-W520: 7.166360ms, 40000)\n", t.stop() * 10, fts.size()); printf("Note, in this case, feature detection also contains the cam2world projection of the feature.\n"); cv::Mat img_rgb = cv::Mat(img.size(), CV_8UC3); cv::cvtColor(img, img_rgb, CV_GRAY2RGB); std::for_each(fts.begin(), fts.end(), [&](Feature* i){ cv::circle(img_rgb, cv::Point2f(i->px[0], i->px[1]), 4 * (i->level + 1), cv::Scalar(0, 255, 0), 1); }); cv::imshow("ref_img", img_rgb); cv::waitKey(0); std::for_each(fts.begin(), fts.end(), [&](Feature* i){ delete i; }); return 0; }
int main(int argc, char **argv) { CmdLine cmd; std::string sSfM_Data_Filename; cmd.add( make_option('i', sSfM_Data_Filename, "input_file") ); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch(const std::string& s) { std::cerr << "Display stats about a sfm_data.X file.\nUsage: " << argv[0] << "\n" << "[-i|--input_file file] path to a SfM_Data scene\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } //--------------------------------------- // Read SfM Scene (image view names) //--------------------------------------- SfM_Data sfm_data; if (!Load(sfm_data, sSfM_Data_Filename, ESfM_Data(ALL))) { std::cerr << std::endl << "The input SfM_Data file \""<< sSfM_Data_Filename << "\" cannot be read." << std::endl; return EXIT_FAILURE; } // Display some stats about the loaded data: std::cout << "Loaded a sfm_data scene with:\n" << " #views: " << sfm_data.GetViews().size() << "\n" << " #poses: " << sfm_data.GetPoses().size() << "\n" << " #intrinsics: " << sfm_data.GetIntrinsics().size() << "\n" << " #tracks: " << sfm_data.GetLandmarks().size() << std::endl; return 0; }
int main(int argc, char *argv[]) { CmdLine cmd; std::string sSfM_Data_Filename; std::string sOutDir = ""; cmd.add( make_option('i', sSfM_Data_Filename, "sfmdata") ); cmd.add( make_option('o', sOutDir, "outdir") ); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch(const std::string& s) { std::cerr << "Usage: " << argv[0] << '\n' << "[-i|--sfmdata] filename, the SfM_Data file to convert\n" << "[-o|--outdir] path\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } // Create output dir if (!stlplus::folder_exists(sOutDir)) stlplus::folder_create( sOutDir ); // Read the input SfM scene SfM_Data sfm_data; if (!Load(sfm_data, sSfM_Data_Filename, ESfM_Data(ALL))) { std::cerr << std::endl << "The input SfM_Data file \""<< sSfM_Data_Filename << "\" cannot be read." << std::endl; return EXIT_FAILURE; } if (exportToCMPMVSFormat(sfm_data, stlplus::folder_append_separator(sOutDir) + "CMPMVS")) return( EXIT_SUCCESS ); else return( EXIT_FAILURE ); }
int main(int argc, char **argv) { CmdLine clp; parse_cmd_line(argc, argv, clp); TBSYS_LOGGER.rotateLog("total_scan.log"); TBSYS_LOGGER.setFileName("total_scan.log"); TBSYS_LOGGER.setLogLevel("info"); clp.log_all(); ob_init_memory_pool(); ObSchemaManager schema_mgr; if (NULL != clp.schema_file) { tbsys::CConfig config; if (!schema_mgr.parse_from_file(clp.schema_file, config)) { TBSYS_LOG(WARN, "parse schema fail"); exit(-1); } } else if (OB_SUCCESS != fetch_schema(clp.root_addr, clp.root_port, schema_mgr)) { TBSYS_LOG(WARN, "fetch schema fail"); exit(-1); } schema_mgr.print_info(); MutatorBuilder mb; mb.init(schema_mgr, clp.prefix_start, clp.suffix_length, clp.serv_addr, clp.serv_port, clp.table_start_version, clp.max_cell); ObServer dst_host; dst_host.set_ipv4_addr(clp.serv_addr, clp.serv_port); MockClient client; client.init(dst_host); scan_check_all(mb, client, clp.table_start_version, clp.using_id, clp.check); client.destroy(); }
int main(int argc, char *argv[]) { CmdLine cmd; std::string sSfMDir; std::string sOutDir = ""; cmd.add( make_option('i', sSfMDir, "sfmdir") ); cmd.add( make_option('o', sOutDir, "outdir") ); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch(const std::string& s) { std::cerr << "Usage: " << argv[0] << ' ' << "[-i|--sfmdir path, the SfM_output path] " << "[-o|--outdir path] " << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } // Create output dir if (!stlplus::folder_exists(sOutDir)) stlplus::folder_create( sOutDir ); Document m_doc; if (m_doc.load(sSfMDir)) { exportToCMPMVSFormat(m_doc, stlplus::folder_append_separator(sOutDir) + "CMPMVS", stlplus::folder_append_separator(sSfMDir) + "images"); return( EXIT_SUCCESS ); } // Exit program return( EXIT_FAILURE ); }
int main(int argc, char *argv[]) { CmdLine cmd; std::string first_frame_name; std::string second_frame_name; cmd.add(make_option('f', first_frame_name, "firstname")); cmd.add(make_option('s', second_frame_name, "secondname")); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch (const std::string& s) { std::cerr << "Feature detector \nUsage: " << argv[0] << "\n" << "[-f|--firstname name]\n" << "[-s|--secondname name]\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } cv::Mat first_img(cv::imread(first_frame_name, 0)); cv::Mat second_img(cv::imread(second_frame_name, 0)); assert(first_img.type() == CV_8UC1 && !first_img.empty()); assert(second_img.type() == CV_8UC1 && !second_img.empty()); AbstractCamera* cam = new PinholeCamera(752, 480, 315.5, 315.5, 376.0, 240.0); FramePtr fisrt_frame(new Frame(cam, first_img, 0.0)); FramePtr second_frame(new Frame(cam, second_img, 1.0)); Initialization init; init.addFirstFrame(fisrt_frame); init.addSecondFrame(second_frame); std::cout << second_frame->T_f_w_ << std::endl; return 0; }
int main(int argc, char *argv[]) { CmdLine cmd; std::string first_frame_name; std::string second_frame_name; cmd.add(make_option('f', first_frame_name, "firstname")); cmd.add(make_option('s', second_frame_name, "secondname")); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch (const std::string& s) { std::cerr << "Feature detector \nUsage: " << argv[0] << "\n" << "[-f|--firstname name]\n" << "[-s|--secondname name]\n" << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } cv::Mat first_img(cv::imread(first_frame_name, 0)); cv::Mat second_img(cv::imread(second_frame_name, 0)); assert(first_img.type() == CV_8UC1 && !first_img.empty()); assert(second_img.type() == CV_8UC1 && !second_img.empty()); AbstractCamera* cam = new MonocularCamera(752, 480, 315.5, 315.5, 376.0, 240.0); ORBextractor *extractor = new ORBextractor(2*1000); System system("D:\\dataset\\Vocabulary\\ORBvoc.bin", "D:\\dataset\\TUM1.yaml"); system.addImage(first_img, 0); system.addImage(second_img, 1); delete extractor; delete cam; return 0; }
void checkIfReplMissingFromCommandLine() { Lock::GlobalWrite lk; // _openAllFiles is false at this point, so this is helpful for the query below to work as you can't open files when readlocked if( !cmdLine.usingReplSets() ) { Client::GodScope gs; DBDirectClient c; unsigned long long x = c.count("local.system.replset"); if( x ) { log() << endl; log() << "** warning: mongod started without --replSet yet " << x << " documents are present in local.system.replset" << endl; log() << "** restart with --replSet unless you are doing maintenance and no other clients are connected" << endl; log() << endl; } } }
int main(int argc, char **argv) { CmdLine cmd; std::string sInputImage; cmd.add( make_option('i', sInputImage, "imafile") ); try { if (argc == 1) throw std::string("Invalid command line parameter."); cmd.process(argc, argv); } catch(const std::string& s) { std::cerr << "Usage: " << argv[0] << ' ' << "[-i|--imafile path] " << std::endl; std::cerr << s << std::endl; return EXIT_FAILURE; } std::cout << " You called : " <<std::endl << argv[0] << std::endl << "--imafile " << sInputImage << std::endl; #ifdef USE_EXIV2 Exif_IO* exif_io = new Exif_IO_Exiv2( sInputImage ); #else Exif_IO* exif_io = new Exif_IO_OpenExif( sInputImage ); #endif std::cout << "width : " << exif_io->getWidth() << std::endl; std::cout << "height : " << exif_io->getHeight() << std::endl; std::cout << "focal : " << exif_io->getFocal() << std::endl; std::cout << "brand : " << exif_io->getBrand() << std::endl; std::cout << "model : " << exif_io->getModel() << std::endl; delete exif_io; return EXIT_SUCCESS; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { char *szCommandLine; // Set hinst, and zero hWnd g_hInstance = hInstance; g_hWnd = NULL; // Init CmdLine (Get full command line -- same as in main()) szCommandLine = GetCommandLine(); g_oCmdLine.SetCmdLine(szCommandLine); // Run the app if (g_oApp.Create(nCmdShow) == FALSE) return 1; else return 0; } // WinMain()
bool MiscDbugCmd::updateAcl(const CmdLine& req) { bool updated; String optK("acl"); const String* optV = req.opt(optK, 0 /*defaultV*/); if (optV == 0) { updated = false; } else { unsigned int cap = ACL_CAP0; char delim = ','; IpAddrSet addrRange(optV->ascii(), delim, cap); sysIo_->setAcl(addrRange); updated = true; } return updated; }
// // version-show [--v] // bool MiscDbugCmd::doVersionShow(const CmdLine& req) { // Start with hosting OS version. String rsp; const wchar_t* osVer = Process::osVer(); swprintf(rsp, L"%9s: %s\n", L"osVer", osVer); delete[] osVer; // Then module versions. String optK("v"); Bool showAll(req.opt(optK), false /*defaultV*/); Process myProc(Process::myId()); myProc.apply(showAll? showModule: showExe, &rsp); // Terminating response. respond(req, rsp); bool cmdIsValid = true; return cmdIsValid; }
bool MiscDbugCmd::rmFromAcl(const CmdLine& req) { bool updated = false; String optK("remove"); Bool removing(req.opt(optK), false /*defaultV*/); if (removing) { IpAddrSet addrRange; bool ok = getAddrRange(req, addrRange); if (ok) { IpAddrSet acl(sysIo_->acl()); updated = acl.rm(addrRange); if (updated) { sysIo_->setAcl(acl); } } } return updated; }