BOOST_FIXTURE_TEST_CASE(test_bow, test::Peppers) { VocabularyPtr vocabulary(test::load<vis::Vocabulary>(VOCABULARY_FILE)); BowHog extractor(*vocabulary); arma::fvec descriptors = extractor.extract(image); float sum = arma::sum(descriptors); printmat(descriptors); printvar(sum); BOOST_CHECK_EQUAL(extractor.numWords(), descriptors.size()); BOOST_CHECK_CLOSE_FRACTION(sum, 1., 0.1); }
char* printrules(void) { int i; char *s; s = nil; for(i=0; i<nvars; i++) s = concat(s, printvar(&vars[i])); for(i=0; i<nports; i++) s = concat(s, printport(ports[i])); s = concat(s, "\n"); for(i=0; rules[i]; i++) s = concat(s, printrule(rules[i])); return s; }
int main (int argc, char **argv) { int ch; const struct conf_variable *cp; const struct spec_variable *sp; const char *varname, *pathname; int found; setlocale (LC_ALL, ""); while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != -1) { switch (ch) { case 'a': a_flag = 1; break; case 'v': v_flag = 1; break; case 'h': usage (0); case 'V': print_version (); return 0; default: fprintf (stderr, "Try `%s --help' for more information.\n", program_invocation_short_name); return 1; } } argc -= optind; argv += optind; if (v_flag) { if (a_flag || argc < 2) usage (1); for (sp = spec_table; sp->name != NULL; sp++) { if (strcmp (argv[0], sp->name) == 0) { if (sp->valid != 1) error (EXIT_FAILURE, 0, "unsupported specification \"%s\"", argv[0]); break; } } if (sp->name == NULL) error (EXIT_FAILURE, 0, "unknown specification \"%s\"", argv[0]); argc--; argv++; } if (!a_flag) { if (argc == 0) usage (1); varname = argv[0]; argc--; argv++; } else varname = NULL; if (argc > 1) usage (1); pathname = argv[0]; /* may be NULL */ found = 0; for (cp = conf_table; cp->name != NULL; cp++) { if (a_flag || strcmp (varname, cp->name) == 0) { /* LINTED weird expression */ if ((cp->type == PATHCONF) == (pathname != NULL)) { printvar (cp, pathname); found = 1; } else if (!a_flag) usage (1); } } if (!a_flag && !found) error (EXIT_FAILURE, 0, "Unrecognized variable `%s'", varname); fflush (stdout); return ferror (stdout) ? EXIT_FAILURE : EXIT_SUCCESS; }
void Debug() { printvar("%i",oldSize); printvar("%i",newSize); }