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

1  
!7
2  
3  
replace Finder with F1<RGBImage, RectAndState>.
4  
5  
p-exp {
6  
  L<File> files = markedEyebrowsFiles();
7  
  final FaceFinderByPictures1 faceFinder = defaultFaceFinderByPictures();
8  
  // images are eyebrow-marked full-size faces
9  
  L<RGBImageRectAndState> images = map(markedEyebrowsFiles(), func(File f) -> RGBImageRectAndState {
10  
    RGBImage full = loadRGBImage(f);
11  
    Rect face = faceFinder.get(full);
12  
    ret RGBImageRectAndState(rgbClip(full, face),
13  
      clipRect((Rect) unstruct(getFileInfoField(f, "Eyebrow position")), face),
14  
      getFileInfoField(f, "Eyebrow state"));
15  
  });
16  
  
17  
  F1<RGBImage, Rect> dummyFaceFinder = func(RGBImage img) -> Rect { rgbBounds(img) };
18  
  
19  
  //showRGBImageAndRects(images);
20  
  
21  
  final int w = /*32*/50; // face is resized to this width
22  
  int limit = 95; // search for smallest finder with at least 95% accuracy
23  
  
24  
  EyebrowFinder1 finder = new(dummyFaceFinder, w, map(images, func(RGBImageRectAndState image) -> Pair<RGBImage, S> {
25  
    RGBImage scaledFace = rgbScaleToWidth(image.image, w);
26  
    Rect scaledRect = scaleRect_imageToImage(image.rect, image.image, scaledFace);
27  
    ret pair(rgbClip(scaledFace, scaledRect), image.state);
28  
  }));
29  
  showImage(mergeRGBImagesVertically(pairsA(finder.pictures)));
30  
  
31  
  saveTextFileVerbose(javaxDataDir("Eyebrow Finder/full-finder.struct"), struct(finder));
32  
  new Best<Finder> best;
33  
  video_scoreRectAndState_step(best, images, finder);
34  
  showImage(mergeRGBImagesAndRects(callEyebrowFinder(finder, rgbImageAndRects_images(images))));
35  
}

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: 373 / 963
Version history: 21 change(s)
Referenced in: [show references]