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

28
LINES

< > BotCompany Repo | #1025027 // imageWithProtos_doAllOnAll

JavaX fragment (include) [tags: use-pretranspiled]

Uses 108K of libraries. Click here for Pure Java version (10113L/71K).

1  
static <Segment extends BWImageAndRect> void imageWithProtos_doAllOnAll(ImageWithProtos<Segment> info,
2  
  Map<S, BWImage> protos, O... _) {
3  
  if (info == null) ret;
4  
  long time = sysNow();
5  
  double minScore = doublePar minScore(_, 95);
6  
  AOA_CompareImagesToProtos aoa = info.aoa;
7  
  aoa.addProtos(protos);
8  
  for (BWImageAndRect s : info.segments)
9  
    s.bw = toBWImage(bufferedImageClip(info.image, s.rect));
10  
  aoa.addImages(iotaKeys_str(collect bw(info.segments)));
11  
  stepAll(aoa);
12  
13  
  Map<S, Scored<S>> bestImageForProto = aoa.bestImageForProto;
14  
  Map<S, Scored<S>> foundProtos1 = filterMapByValuePredicate(bestImageForProto, v -> score(v) >= minScore/100);
15  
  //print(+foundProtos1);
16  
  Map<S, Segment> foundProtos = ciMap();
17  
  for (S proto, Scored<S> scoredImage : foundProtos1)
18  
    mapPut(foundProtos, proto, getStartingWith1(info.segments, parseInt(scoredImage!)));
19  
  info.foundProtos = foundProtos;
20  
  
21  
  //print('foundProtos, info.foundProtos);
22  
  optPar ImageSurface isThings;
23  
  if (isThings != null) isThings.setImage(
24  
    mergeBWImagesHorizontally(map bwInverted(collect bw(values(info.foundProtos)))));
25  
  print(mapValues doubleScoreAsIntPercent(bestImageForProto));
26  
  if (boolPar printTiming(_))
27  
    done2_always("AOA", time);
28  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1025027
Snippet name: imageWithProtos_doAllOnAll
Eternal ID of this version: #1025027/10
Text MD5: f2d61dc3cd2a122233fd8793beb82271
Transpilation MD5: 24890dd025ea8f05b452fc4cacb33b4a
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-01 18:49:54
Source code size: 1259 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 225 / 353
Version history: 9 change(s)
Referenced in: [show references]