int main(int argc, char *argv[]) { int time = getTimeMill(); QCoreApplication a(argc, argv); QString dirPath = (argc > 1) ? a.arguments()[1] : a.applicationDirPath(); QString patternPath = (argc > 2) ? a.arguments()[2] : QString("input.jpg"); QImage pattern(patternPath); if (pattern.isNull()) { pattern = QImage("input.jpg"); } if (pattern.isNull()) cout << "No pattern image." << endl; else { gpattern = GImage(pattern); GPyramid pyr(gpattern, 1.6f, 0.5f, 3); poivec p = getDOGDetection(pyr); p = calculateOrientations(pyr, p); pdescs = getDescriptors(pyr, p); processDir(dirPath); } time = getTimeMill() - time; cout << "Completed in " << time << "ms." << endl; return 0; // return a.exec(); }
void processFile(QString &path) { QImage img(path); if (img.isNull()) return; GImage gimg = GImage(img); GPyramid pyr(gimg, 1.6f, 0.5f, 3); auto p = getDOGDetection(pyr); p = calculateOrientations(pyr, p); auto descs = getDescriptors(pyr, p); auto m = getMatchingPOIs(pdescs, descs, numeric_limits<float>::max()); int k = getHough(m.first, m.second, gimg.width, gimg.height, 1e-3f, 1e3f, 100, 100, 22, 10).second; if (k >= 4) cout << path.toStdString() << endl; }
vector<InterestPoint> InterestPointsDetector::detectHarris(float threshold) { Kernel sobelX = Kernel::createSobelKernelX(); Convolution convX = Convolution(sobelX, type); FImage derXStore = convX.apply(source); Kernel sobelY = Kernel::createSobelKernelY(); Convolution convY = Convolution(sobelY, type); FImage derYStore = convY.apply(source); FImage minLambdasStore = calculateMinLambdasStore(derXStore, derYStore); vector<InterestPoint> points = determinePointsByRadius( threshold, radiusOfNeighborhood, minLambdasStore); vector<InterestPoint> mostPowerPoint = adaptiveNonMaximumSuppression(points); vector<InterestPoint> mostPPWithOrientation = calculateOrientations(mostPowerPoint); return mostPPWithOrientation; }