static int bwContrastQuadtree_minOfArea(BWImage min, Rect rect) { ret bwContrastQuadtree_minOfArea(min, rect, imageRect(min)); } static int bwContrastQuadtree_minOfArea(BWImage min, Rect rect, Rect block) { Rect r2 = intersectRects(rect, block); if (r2.empty()) ret 255; // simple case 1: no intersection //print(rect + " => " + r2); // simple case 2: whole block if (eq(r2, block)) ret min.getInt(block.x, block.y); // complex case: process subregions int w = block.w, hx = (w+1)/2; int h = block.h, hy = (h+1)/2; ret intMin( // top left area bwContrastQuadtree_minOfArea(min, r2, Rect(block.x, block.y, hx, hy)), // tall slice on the right bwContrastQuadtree_minOfArea(min, r2, Rect(block.x+hx, block.y, w-hx, h)), // wide slice on the bottom bwContrastQuadtree_minOfArea(min, r2, Rect(block.x, block.y+hy, w, h-hy)), // bottom right area bwContrastQuadtree_minOfArea(min, r2, Rect(block.x+hx, block.y+hy, w-hx, h-hy))); }
Began life as a copy of #1026934
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026941 |
Snippet name: | bwContrastQuadtree_minOfArea [approach doesn't work] |
Eternal ID of this version: | #1026941/1 |
Text MD5: | 70bb4f5e9686658fd6deeec48605a058 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-03 03:13:38 |
Source code size: | 1009 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 210 / 235 |
Referenced in: | -