Transpiled version (29225L) is out of date.
persistable sclass G22PixelSplitMasks<A> is IG22OptimizedMasksHolder<A> { replace Mask with IG22Mask<A>. settable Pt splitPixel; settable IG22MasksHolder<A> darkHolder; settable IG22MasksHolder<A> brightHolder; // for search - how much the "correct" branch is preferred settable double bias = 0.9; public L<Mask> masks() { ret new ConcatOnDemandList( darkHolder.masks(), brightHolder.masks()); } public L<IG22MasksHolder<A>> subHolders() { ret ll(darkHolder, brightHolder); } public void transformSubHolders(IF1<IG22MasksHolder<A>> f) { darkHolder = f.get(darkHolder); brightHolder = f.get(brightHolder); } @Override public PStackComputable<Void> findSimilarMasks(G22FindSimilarMasksTask<A> task) { ret new FindSimilarMasks(task); } record noeq FindSimilarMasks(G22FindSimilarMasksTask task) extends PStackComputableWithStep<Void> is IMakeEmptyClone { bool brightBranch; public selfType makeEmptyClone() { ret new selfType; } void step(IPStack stack) { if (task.ended()) ret with stack.ret(); if (step == 0) { ++step; bool bright = isMaskBright(task.queryImage); if (task.verbose()) printVars("step 0", +splitPixel, +bright); stack.probabilisticOptions(this, ll( withProbability(1.0, self -> self.brightBranch = bright), withProbability(1-bias, self -> self.brightBranch = !bright))); } else { if (task.verbose()) printVars("step 1", +splitPixel, +brightBranch); IG22MasksHolder<A> branch = brightBranch ? brightHolder : darkHolder; stack.tailCall(branch.findSimilarMasks(task)); } } } // Does the mask belong in darkHolder or brightHolder? bool isMaskBright(Image2B maskImage) { ret maskImage.getBoolPixel(splitPixel); } public <B> IG22MasksHolder<B> cloneTreeWithLabelTransform(IF1<A, B> f) { ret new G22PixelSplitMasks().splitPixel(splitPixel) .darkHolder(darkHolder.cloneTreeWithLabelTransform(f)) .brightHolder(brightHolder.cloneTreeWithLabelTransform(f)); } !include early #1035854 // Masks holder Include }
Began life as a copy of #1035850
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035861 |
Snippet name: | G22PixelSplitMasks - masks holder split by brightness of certain pixel |
Eternal ID of this version: | #1035861/30 |
Text MD5: | 1fd5c721af88616edfa656fd254662a1 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-09-05 02:47:07 |
Source code size: | 2240 bytes / 66 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 189 / 405 |
Version history: | 29 change(s) |
Referenced in: | [show references] |