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

22
LINES

< > BotCompany Repo | #1032023 // compressBWIntegralImage [dev.]

JavaX fragment (include)

static IIntegralImage compressBWIntegralImage(IIntegralImage img, int recursionLevels default 5) {
  if (recursionLevels <= 0) ret BWIntegralImage(img);
  
  int w = img.getWidth(), h = img.getHeight();
  
  if (w >= 2) {
    IIHorizontalSplit split = new(img);
    var a = split.a();
    var b = split.b();
    var a2 = toIISingleColorIfPossible(a);
    var b2 = toIISingleColorIfPossible(b);
    if (a != a2 || b == b2) {
      split.setA(a != a2 ? a2 : compressBWIntegralImage(a, recursionLevels-1));
      split.setB(b != b2 ? b2 : compressBWIntegralImage(b, recursionLevels-1));
      img = split;
    }
  }
  
  // TODO: vertical split
  
  ret img;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032023
Snippet name: compressBWIntegralImage [dev.]
Eternal ID of this version: #1032023/3
Text MD5: cc37119cc73e7a76c90462a65b0f4e84
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-11 03:07:07
Source code size: 678 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 202 / 204
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)