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

35
LINES

< > BotCompany Repo | #1019551 // Make Eyebrow Finder [OK, just uses all pictures and a certain width]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (12263L/89K).

!7

replace Finder with F1<RGBImage, RectAndState>.

p-exp {
  L<File> files = markedEyebrowsFiles();
  final FaceFinderByPictures1 faceFinder = defaultFaceFinderByPictures();
  // images are eyebrow-marked full-size faces
  L<RGBImageRectAndState> images = map(markedEyebrowsFiles(), func(File f) -> RGBImageRectAndState {
    RGBImage full = loadRGBImage(f);
    Rect face = faceFinder.get(full);
    ret RGBImageRectAndState(rgbClip(full, face),
      clipRect((Rect) unstruct(getFileInfoField(f, "Eyebrow position")), face),
      getFileInfoField(f, "Eyebrow state"));
  });
  
  F1<RGBImage, Rect> dummyFaceFinder = func(RGBImage img) -> Rect { rgbBounds(img) };
  
  //showRGBImageAndRects(images);
  
  final int w = /*32*/50; // face is resized to this width
  int limit = 95; // search for smallest finder with at least 95% accuracy
  
  EyebrowFinder1 finder = new(dummyFaceFinder, w, map(images, func(RGBImageRectAndState image) -> Pair<RGBImage, S> {
    RGBImage scaledFace = rgbScaleToWidth(image.image, w);
    Rect scaledRect = scaleRect_imageToImage(image.rect, image.image, scaledFace);
    ret pair(rgbClip(scaledFace, scaledRect), image.state);
  }));
  showImage(mergeRGBImagesVertically(pairsA(finder.pictures)));
  
  saveTextFileVerbose(javaxDataDir("Eyebrow Finder/full-finder.struct"), struct(finder));
  new Best<Finder> best;
  video_scoreRectAndState_step(best, images, finder);
  showImage(mergeRGBImagesAndRects(callEyebrowFinder(finder, rgbImageAndRects_images(images))));
}

Author comment

Began life as a copy of #1019536

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1019551
Snippet name: Make Eyebrow Finder [OK, just uses all pictures and a certain width]
Eternal ID of this version: #1019551/22
Text MD5: 845ab8b8cc6a0330ea520aa16460f54e
Transpilation MD5: 6d8440a7fd740fbdbc4f5289514a2fa9
Author: stefan
Category: javax / imaging
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-12 02:09:08
Source code size: 1541 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 372 / 962
Version history: 21 change(s)
Referenced in: