Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1023109 // video_scoreRect_score - look at both coordinates. 0 = worst, 1 = best

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2027L/13K).

static double video_scoreRect_score(Rect expected, Rect guessed, double tolerance) {
  if ((guessed == null) != (expected == null)) ret 0;
  if (expected == null) ret 1;
  ret clamp(1-doubleAverage(
    ptDistance(rectCenter(guessed), rectCenter(expected)),
    abs(guessed.w-expected.w),
    abs(guessed.h-expected.h))
    /tolerance, 0, 1);
}

Author comment

Began life as a copy of #1019530

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: #1023109
Snippet name: video_scoreRect_score - look at both coordinates. 0 = worst, 1 = best
Eternal ID of this version: #1023109/4
Text MD5: 47c5fdae88ccd61115dfc609c00c45dc
Transpilation MD5: d51595c98c95d5d89791d9c62eed135e
Author: stefan
Category: javax / video
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-25 15:51:16
Source code size: 352 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 287 / 374
Version history: 3 change(s)
Referenced in: [show references]