1 | static IIntegralImage compressBWIntegralImage(IIntegralImage img, int recursionLevels default 5) { |
2 | if (recursionLevels <= 0) ret BWIntegralImage(img); |
3 | |
4 | int w = img.getWidth(), h = img.getHeight(); |
5 | |
6 | if (w >= 2) { |
7 | IIHorizontalSplit split = new(img); |
8 | var a = split.a(); |
9 | var b = split.b(); |
10 | var a2 = toIISingleColorIfPossible(a); |
11 | var b2 = toIISingleColorIfPossible(b); |
12 | if (a != a2 || b == b2) { |
13 | split.setA(a != a2 ? a2 : compressBWIntegralImage(a, recursionLevels-1)); |
14 | split.setB(b != b2 ? b2 : compressBWIntegralImage(b, recursionLevels-1)); |
15 | img = split; |
16 | } |
17 | } |
18 | |
19 | // TODO: vertical split |
20 | |
21 | ret img; |
22 | } |
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: | 203 / 205 |
Version history: | 2 change(s) |
Referenced in: | [show references] |