!7 module WebCamToImageBuckets > DynPrintLog { int width = 16; transient BufferedImage lastImage; transient new LL buckets; S switchableFields() { ret 'width; } start { doEvery(1000, rstUpdate()); } void update { final BufferedImage img = dm_webCamImage(); temp tempAfterwards(r { lastImage = img }); if (img == null || img == lastImage) ret; RGBImage pat = RGBImage(resizeImage(img, width)); new Best best; for i over buckets: { Pair p = rgbMostSimilarImage(pat, buckets.get(i), 0); best.put(i, p.b); } print("Best bucket: " + best); if (best.score() < minScore) { print("Opening new bucket"); buckets.add(ll(pat)); } } }