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).

static <Segment extends BWImageAndRect> void imageWithProtos_doAllOnAll(ImageWithProtos<Segment> info,
  Map<S, BWImage> protos, O... _) {
  if (info == null) ret;
  long time = sysNow();
  double minScore = doublePar minScore(_, 95);
  AOA_CompareImagesToProtos aoa = info.aoa;
  aoa.addProtos(protos);
  for (BWImageAndRect s : info.segments)
    s.bw = toBWImage(bufferedImageClip(info.image, s.rect));
  aoa.addImages(iotaKeys_str(collect bw(info.segments)));
  stepAll(aoa);

  Map<S, Scored<S>> bestImageForProto = aoa.bestImageForProto;
  Map<S, Scored<S>> foundProtos1 = filterMapByValuePredicate(bestImageForProto, v -> score(v) >= minScore/100);
  //print(+foundProtos1);
  Map<S, Segment> foundProtos = ciMap();
  for (S proto, Scored<S> scoredImage : foundProtos1)
    mapPut(foundProtos, proto, getStartingWith1(info.segments, parseInt(scoredImage!)));
  info.foundProtos = foundProtos;
  
  //print('foundProtos, info.foundProtos);
  optPar ImageSurface isThings;
  if (isThings != null) isThings.setImage(
    mergeBWImagesHorizontally(map bwInverted(collect bw(values(info.foundProtos)))));
  print(mapValues doubleScoreAsIntPercent(bestImageForProto));
  if (boolPar printTiming(_))
    done2_always("AOA", time);
}

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: 224 / 351
Version history: 9 change(s)
Referenced in: [show references]