Package de.offis.faint.model

Examples of de.offis.faint.model.FaceDatabase


   * @see de.offis.faint.interfaces.IRecognitionFilter#filterRecognitionResult(de.offis.faint.model.Region, java.util.HashMap)
   */
  public HashMap<String, Integer> filterRecognitionResult(Region region,
      HashMap<String, Integer> result) {
   
    FaceDatabase faceDB = MainController.getInstance().getFaceDB();
   
    Region[] knownRegions = faceDB.getRegionsForImage(region.getImage());
   
    for (String person : result.keySet()){
      for (Region regionOnImage : knownRegions){
        if (!region.equals(regionOnImage) && faceDB.getAnnotation(regionOnImage).equals(person))
          result.put(person, 0);         
      }
    }
    return result;
  }
View Full Code Here


    // try to load database from disk
    System.out.println("Preparing face database...");
    try {
      faceDB = FaceDatabase.recoverFromDisk();
    }catch(IOException ex){
      faceDB = new FaceDatabase();
    }
   
    // init plugins specified in config file
    System.out.println("Loading Modules...");
    File configFile = new File(dataDir.getAbsoluteFile() + File.separator + PLUGIN_CONFIG_FILE);
View Full Code Here

        new InfoDialog(null, "<html>Not enough training images availble for EigenfaceRecognition.<br>Please classify the first faces manually!</html>");
        return new HashMap<String, Integer>();
      }
    }
   
    FaceDatabase db = MainController.getInstance().getFaceDB();
    String[] names = db.getExistingAnnotations();
   
    BufferedImage unknownFaceImage = region.toThumbnail(Constants.FACE_THUMBNAIL_SIZE);

    byte[] unknownFace = Utilities.bufferedImageToIntensityArray(unknownFaceImage);
    double[] unknownFaceWeight = this.getWeightForImage(unknownFace);

    // Mirrored region may increase recognition performance
    double[] unknownMirroredFaceWeight = null;
    if (this.mirrorFaces){
      byte[] mirroredFace = new byte[unknownFace.length];
      for (int i = 0; i < Constants.FACE_THUMBNAIL_SIZE.height; i++){
        for (int j = 0; j < Constants.FACE_THUMBNAIL_SIZE.width; j++){
          int elem = i * Constants.FACE_THUMBNAIL_SIZE.width + j;
          mirroredFace[elem] = unknownFace[(i+1) * Constants.FACE_THUMBNAIL_SIZE.width - j - 1];
        }     
      }
      unknownMirroredFaceWeight = this.getWeightForImage(mirroredFace);
    }

    HashMap<String, Integer> result = new HashMap<String, Integer>names.length);
    ArrayList<SortableContainer<Region>> bestHits = new ArrayList<SortableContainer<Region>>();
    for (String name : names) {
      Region image = null;
      Region[] regionsForName = db.getRegionsForFace(name);

      if (regionsForName != null) {
        double minDist = Double.MAX_VALUE;
       
        for (int i = 0; i < regionsForName.length; i++) {
View Full Code Here

TOP

Related Classes of de.offis.faint.model.FaceDatabase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.