static double scoreColorPredicateByRect(F1<Int, Bool> predicate, LPair<RGBImage, Rect> testImages) { int score = 0, count = 0; for (Pair<RGBImage, Rect> p : testImages) { RGBImage img = p.a; int w = img.getWidth(), h = img.getHeight(); //printStructs(+w, +h, r := p.b); for y to h: for x to w: { bool detected = callF(predicate, img.getInt(x, y)); bool real = rectContains(p.b, x, y); score += detected == real ? 1 : 0; } count += w*h; } ret doubleRatio(score, count); }
Began life as a copy of #1022940
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022943 |
Snippet name: | scoreColorPredicateByRect |
Eternal ID of this version: | #1022943/1 |
Text MD5: | 84bfb97bcfd7b2fa00b337d17302188e |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-15 02:54:39 |
Source code size: | 549 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 261 / 302 |
Referenced in: | [show references] |