srecord noeq RecursiveImageSplitter( IProbabilisticScheduler scheduler, URecognizer recognizer) { replace Cell with URecognizer.Cell. Node root; int minPixelSize = 64; // don't dive below this (for the splitting) // actual class for leaves, base class for split nodes class Node > Pair<Node> { // funky type Cell cell; int color; // known error (distance to image). will go up as image is // scanned in more detail. double error; *() {} *(Cell *cell) { color = cell.intColor(); } // availability - how important are we? (our percentage of total area) double availability() { ret recognizer.relativeArea(position); } double splitPossibility() { ret zeroOrOne(diameter(position) < minPixelSize); } Rect position() { ret cell.rectInImage(); } void scheduleSplits { var p = availability() * splitProbability(); scheduler.at(p, r splitHorizontally); scheduler.at(p, r splitVertically); } void splitHorizontally { } void splitVertically { /* TODO */ } } class Split > Node { int splitDimension; int splitPoint; } run { // make single color root from top cell. // let the node schedule its possible splits. root = Node(recognizer.cell()); root.scheduleSplits(); } }
Began life as a copy of #1032053
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1032154 |
| Snippet name: | RecursiveImageSplitter - probabilistic (of course) [dev.] |
| Eternal ID of this version: | #1032154/1 |
| Text MD5: | bee15f51035f89a69c96fe3539986ad5 |
| Author: | stefan |
| Category: | javax / probabilistic computing / images |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-08-15 02:56:03 |
| Source code size: | 1422 bytes / 57 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 374 / 404 |
| Referenced in: | [show references] |