1 | static double scoreColorPredicateByRect(F1<Int, Bool> predicate, LPair<RGBImage, Rect> testImages) { |
2 | int score = 0, count = 0; |
3 | for (Pair<RGBImage, Rect> p : testImages) { |
4 | RGBImage img = p.a; |
5 | int w = img.getWidth(), h = img.getHeight(); |
6 | //printStructs(+w, +h, r := p.b); |
7 | for y to h: |
8 | for x to w: { |
9 | bool detected = callF(predicate, img.getInt(x, y)); |
10 | bool real = rectContains(p.b, x, y); |
11 | score += detected == real ? 1 : 0; |
12 | } |
13 | count += w*h; |
14 | } |
15 | ret doubleRatio(score, count); |
16 | } |
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: | 262 / 304 |
Referenced in: | [show references] |