sbool bwRawImageSearch_verbose; static BWImageSectionComparator bwRawImageSearch_comparator; static int bwRawImageSearch_maxEntries = 1000; static L bwRawImageSearch(BWImage big, BWImage pat, float similarity) { ret bwRawImageSearch(big, pat, similarity, bwRawImageSearch_maxEntries); } // similarity = e.g. 0.99f static L bwRawImageSearch(BWImage big, BWImage pat, float similarity, int maxEntries) { new L found; int wp = pat.getWidth(), hp = pat.getHeight(); int w = big.getWidth(), h = big.getHeight(); float maxError = (1f-similarity)*wp*hp; for (int y = 0; y < h-hp; y++) for (int x = 0; x < w-wp; x++) { float diff = bwRawImageSearch_comparator != null ? bwRawImageSearch_comparator.compare(big, pat, x, y, maxError) : bwImageSectionsSimilarity(big, pat, x, y, maxError); if (diff <= maxError) { float sim = 1-diff/(wp*hp); if (bwRawImageSearch_verbose) print(" Image found at " + x + "/" + y + " [sim: " + formatDouble(sim, 4) + "]"); Rect r = new Rect(x, y, wp, hp); found.add(new FoundImg(r, sim)); ping(); if (l(found) >= maxEntries) ret found; x += wp-1; } } ret found; }