!7 module WebCamFaceFinder > DynImageSurface { transient BufferedImage lastImage; FaceFinderByPictures1 finder; bool overlay; start { if (finder == null) finder = unstructFile(javaxDataDir("Face Finder/smallest-finder-over-95.struct")); doEvery(100, rstUpdate()); } visualize { JComponent c = super.visualize(); imageSurface_pixelated(imageSurface); ret withCenteredButtons(c, jLiveValueCheckBox("Overlay", dm_fieldLiveValue('overlay))); } void update { if (imageSurface == null) ret; final BufferedImage img = dm_webCamImage(); temp tempAfterwards(r { lastImage = img }); if (img == null || img == lastImage) ret; FoundImgPlus found = finder.getPlus(RGBImage(img)); setSelection(foundImgToRect(found)); if (overlay) { img = cloneBufferedImage(img); if (found != null) fillRect(img, found.r, Color.white); } setImage(img); } }