static BWImage bwFoldImage_withHalfCorners(BWImage big, BWImage pat) { int wp = pat.getWidth(), hp = pat.getHeight(); int w = big.getWidth(), h = big.getHeight(); BWImage out = new(w, h+); for (int y = 0; y < h; y++) for (int x = 0; x < w; x++) out.setPixel(x, y, bwImageSectionsSimilarity2_partial(big, pat, x, y, max(0, wp/2-x), max(0, hp/2-y), min(wp, w+wp-x), min(hp, h+hp-y), 0)); ret out; }