!7 module CachedTilesToBuckets > DynPrintLogAndEnabled { int tileWidth = 16, tileHeight = 16; float threshold = 0.98f; transient new ImageBuckets buckets; start { thread "Calc" { calc(); } } void calc enter { buckets.similarityThreshold = threshold; L files = listImageFiles(imageSnippetsCacheDir()); int count = 0; for (File f : files) pcall { ++count; if (!licensed()) ret; if (!enabled) continue with sleepSeconds(1); RGBImage rgb = loadImage(f); L tiles = rgbImageToFixedSizeTiles(rgb, tileWidth, tileHeight); for (RGBImage tile : tiles) buckets.addImage(tile); print("Files processed: " + count + "/" + l(files) + ". Buckets: " + l(buckets.buckets) + ", images: " + buckets.images + ", duplicates: " + buckets.totalDuplicates); } } }