Transpiled version (13760L) is out of date.
// A is the user object associated with each mask (aka a "label") sclass G22MasksHolder<A> { record noeq Mask(Image2B image, A label) { } settable WidthAndHeight maskSize; new L<Mask> masks; new Set<A> labels; // default mask size { maskSize(16); } selfType maskSize(int size) { ret maskSize(widthAndHeight(size)); } Image2B regionToMaskImage(IImageRegion region) { ret toImage2B(scaledIBinaryImage(maskSize, regionToIBinaryImage(region))); } void addRegion(IImageRegion region, A label) { masks.add(new Mask(regionToMaskImage(region), label)); ghost_cache = null; certainty_cache = null; labels.add(label); } L<Image2B> maskImages() { ret map(masks, mask -> mask.image); } BufferedImage masksSquare() { ret mergeBufferedImagesAsSquare(allToBufferedImage(maskImages())); } toString { ret renderVars(shortClassName(this), +maskSize, masks := n2(masks), +certainty()); } simplyCached FloatBWImage ghost() { ret preciseAverageOfBinaryImages(maskImages()); } simplyCached double certainty() { ret preciseCertaintyImage(ghost()).averageBrightness(); } }
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035842 |
Snippet name: | G22MasksHolder (old) |
Eternal ID of this version: | #1035842/17 |
Text MD5: | c60d082063fd3a8f734ff0a8457836e6 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-05 15:50:01 |
Source code size: | 1231 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 147 / 266 |
Version history: | 16 change(s) |
Referenced in: | #1035849 - G22SimpleMasksHolder - use G22HashedMasks instead #1035850 - G22HashedMasks - G22MasksHolder plus a hashmap to find identical masks |