int main(int argc, char *argv[]) { br::Context::initialize(argc, argv); // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("FaceRecognition"); QSharedPointer<br::Distance> distance = br::Distance::fromAlgorithm("FaceRecognition"); // Initialize templates br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg"); br::Template queryB("../data/MEDS/img/S386-04-t10_01.jpg"); br::Template target("../data/MEDS/img/S354-02-t10_01.jpg"); // Enroll templates queryA >> *transform; queryB >> *transform; target >> *transform; printTemplate(queryA); printTemplate(queryB); printTemplate(target); // Compare templates float comparisonA = distance->compare(target, queryA); float comparisonB = distance->compare(target, queryB); // Scores range from 0 to 1 and represent match probability printf("Genuine match score: %.3f\n", comparisonA); printf("Impostor match score: %.3f\n", comparisonB); br::Context::finalize(); return 0; }
int main(int argc, char** argv) { // process the command-line options checkOptions(options, argc, argv); HumdrumFile infile; Array<Array<char> > templatedata; Array<Array<char> > sourcedata; Array<int> datalines; if ((options.getArgCount() < 1) || (options.getArgCount() > 2)) { usage(options.getCommand().data()); exit(1); } int sourcearg = 1; int templatearg = 2; if (reverseQ) { sourcearg = 2; templatearg = 1; } if (options.getArgCount() == 2) { infile.read(options.getArg(sourcearg)); readTemplateContents(templatedata, options.getArg(templatearg).data()); } else { // read second file from standard input if (sourcearg == 1) { infile.read(options.getArg(1)); readTemplateContents(templatedata, cin); } else { infile.read(cin); readTemplateContents(templatedata, options.getArg(1).data()); } } int spine = chooseSpine(interp, infile); fillSourceData(sourcedata, datalines, infile, spine, nullQ); if (debugQ) { cout << "SOURCE DATA: " << endl; printTemplate(sourcedata); cout << "TEMPLATE DATA: " << endl; printTemplate(templatedata); } doDamerauLevenshteinAnalysis(sourcedata, templatedata); if (pweightQ) { printWeights(); } return 0; }
int output(const char* filename, bool isystem, bool useExceptions, bool useVirtualBase, const char* stringTypeName, const char* objectTypeName, const char* indent, bool skeleton, bool generic) { Forward forward(filename); getSpecification()->accept(&forward); forward.generateForwardDeclarations(); printCxx(filename, stringTypeName, objectTypeName, useExceptions, useVirtualBase, indent); if (skeleton) { printSkeleton(filename, isystem, indent); } if (generic) { printTemplate(filename, stringTypeName, objectTypeName, useExceptions, isystem, indent); } return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { bool ret = true; s3ext_loglevel = EXT_ERROR; s3ext_logtype = STDERR_LOG; if (argc == 1) { printUsage(stderr); exit(EXIT_FAILURE); } /* Prepare to receive interrupts */ registerSignalHandler(); map<char, string> optionPairs = parseCommandLineArgs(argc, argv); validateCommandLineArgs(optionPairs); if (!optionPairs.empty()) { const char *arg = optionPairs.begin()->second.c_str(); switch (optionPairs.begin()->first) { case 'c': ret = checkConfig(arg); break; case 'd': ret = downloadS3(arg); break; case 'u': case 'f': ret = uploadS3(optionPairs['u'].c_str(), optionPairs['f'].c_str()); break; case 'h': printUsage(stdout); break; case 't': printTemplate(); break; default: printUsage(stderr); exit(EXIT_FAILURE); } } // Abort should not print the failed info if (ret || S3QueryIsAbortInProgress()) { exit(EXIT_SUCCESS); } else { fprintf(stderr, "Failed. Please check the arguments and configuration file.\n\n"); printUsage(stderr); exit(EXIT_FAILURE); } }
int main(int argc, char *argv[]) { br::Context::initialize(argc, argv); // Retrieve class for enrolling templates using the AgeEstimation algorithm QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("AgeEstimation"); // Initialize templates br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg"); br::Template queryB("../data/MEDS/img/S001-01-t10_01.jpg"); // Enroll templates queryA >> *transform; queryB >> *transform; printTemplate(queryA); printTemplate(queryB); br::Context::finalize(); return 0; }
Hook::Remapper Hook::Remapper::create(const std::string& path) { Remapper rtn; std::string filePath(path); // If the path doesn't end in .config, like the case of a process name, append it. if (filePath.find(".config") == std::string::npos) { filePath += ".config"; } std::ifstream file(filePath); std::cout << "Remapping buttons... "; if (!file) { std::cout << filePath << " config file not found! Using default values." << std::endl; // File not found or available, print the default template. printTemplate(filePath); rtn.mIsDefault = true; return rtn; } std::cout << filePath << " config file found! Reading values.\n"; char buff[256]; file.getline(buff, sizeof(buff)); while (file) { std::string line(buff); if (!line.empty()) { auto pos(line.find_first_of('=')); if (pos != std::string::npos) { auto key(line.substr(0, pos)); auto val(line.substr(pos + 1, std::string::npos)); auto kButt(parseButtonString(key)); auto vButt(parseButtonString(val)); if (kButt == Buttons::INVALID || vButt == Buttons::INVALID) { const static std::string err("Invalid Button Value: "); errorMessage(err + line); } else if (kButt != vButt) { rtn.mMappings.insert(std::pair<Buttons, Buttons>(kButt, vButt)); std::cout << "Enabled remapping: " << key << " -> " << val << std::endl; } } } file.getline(buff, sizeof(buff)); } if (rtn.mMappings.empty()) { std::cout << "No remapped keys found. Ignoring.\n" << std::endl; rtn.mIsDefault = true; } else { std::cout << "Finished button remapping setup.\n" << std::endl; } return rtn; }