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

24
LINES

< > BotCompany Repo | #1006761 // ImageCategorizer

JavaX fragment (include)

sclass ImageCategorizer {
  new L<RGBImage> images;
  float allowedDistance = 0.1f; // allowed difference within category
  
  *() {}
  *(float *allowedDistance) {}
  
  int locateImage(RGBImage img) {
    for i over images:
      if (rgbDistance(images.get(i), img, allowedDistance) <= allowedDistance)
        ret i;
    ret -1;
  }
  
  int addImage(RGBImage img) {
    int i = locateImage(img);
    if (i >= 0) ret i;
    images.add(img);
    ret l(images)-1;
  }
  
  int numCategories() { ret l(images); }
  void clear() { images.clear(); }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006761
Snippet name: ImageCategorizer
Eternal ID of this version: #1006761/5
Text MD5: ece544f54c3f33b381caa35bf2a7e353
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-03 20:13:08
Source code size: 571 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 468 / 1082
Version history: 4 change(s)
Referenced in: [show references]