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

26
LINES

< > BotCompany Repo | #1020190 // All Cached Image Tiles To Buckets [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (16043L/112K).

1  
!7
2  
3  
module CachedTilesToBuckets > DynPrintLogAndEnabled {
4  
  int tileWidth = 16, tileHeight = 16;
5  
  float threshold = 0.98f;
6  
  transient new ImageBuckets buckets;
7  
8  
  start {
9  
    thread "Calc" { calc(); }
10  
  }
11  
  
12  
  void calc enter {
13  
    buckets.similarityThreshold = threshold;
14  
    L<File> files = listImageFiles(imageSnippetsCacheDir());
15  
    int count = 0;
16  
    for (File f : files) pcall {
17  
      ++count;
18  
      if (!licensed()) ret;
19  
      if (!enabled) continue with sleepSeconds(1);
20  
      RGBImage rgb = loadImage(f);
21  
      L<RGBImage> tiles = rgbImageToFixedSizeTiles(rgb, tileWidth, tileHeight);
22  
      for (RGBImage tile : tiles) buckets.addImage(tile);
23  
      print("Files processed: " + count + "/" + l(files) + ". Buckets: " + l(buckets.buckets) + ", images: " + buckets.images + ", duplicates: " + buckets.totalDuplicates);
24  
    }
25  
  }
26  
}

Author comment

Began life as a copy of #1020130

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020190
Snippet name: All Cached Image Tiles To Buckets [dev.]
Eternal ID of this version: #1020190/3
Text MD5: 255d007e05fedcf345d0412c338c2e84
Transpilation MD5: 8849d127926a43c5cd4b1dab7eff4183
Author: stefan
Category: javax / image recognition
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-09 21:57:34
Source code size: 864 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 273 / 347
Version history: 2 change(s)
Referenced in: [show references]