int main(void) { char NewLineChar; signal(SIGINT, CtrlC); printf("string?\n"); scanf("%s", String); scanf("%c", &NewLineChar); StringLength = strlen(String); while (1) { setjmp(GetFileName); printf("file name?\n"); scanf("%s", FileName); if (!strcmp(FileName, "q")) exit(0); FindAllMatches(); } return 0; }
const std::list<FeatureMatch> match_features(const cv::Mat &image, const std::list<const Feature*> &features) { QTime a; int i = 0; a.start(); std::list<FeatureMatch> feature_matches; for (const Feature *feature : features) { int found = 0; if (feature->maxCount == 1) { for (const Sprite &sprite : feature->sprites) { i++; const Match m = FindBestMatch(image, MatchTemplate(sprite.img, sprite.mask), CV_TM_CCORR_NORMED); if (m.value > 0) { feature_matches.push_back(FeatureMatch(feature, &sprite, m)); found++; } } if (!found) { qDebug() << "Not found" << feature->humanName; } } else { int found = 0; for (const Sprite &sprite : feature->sprites) { // FIXME: limited maxCount i++; const std::list<Match> matches = FindAllMatches(image, MatchTemplate(sprite.img, sprite.mask), CV_TM_CCORR_NORMED, sprite.detectionThreshold); for (const Match &m : matches) { feature_matches.push_back(FeatureMatch(feature, &sprite, m)); } found += matches.size(); } qDebug() << "Found" << found << "of" << feature->humanName; } } qDebug() << "elapsed" << a.elapsed() << "per search" << a.elapsed() / i; return feature_matches; }