package ac.essex.ooechs.facedetection.solutions;

import ac.essex.ooechs.imaging.commons.HaarRegions;
import ac.essex.ooechs.imaging.commons.evolved.FaceDetector;

/**
 * <p/>
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version,
 * provided that any use properly credits the author.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details at http://www.gnu.org
 * </p>
 *
 * @author Olly Oechsle, University of Essex, Date: 16-May-2007
 * @version 1.0
 */
public class EvolvedFaceDetector extends FaceDetector {

	public static final int FACE1 = 1;
	public static final int NON_FACE = -1;

	public double calculate( HaarRegions image ) {
        double node6 = image.getOneRectangleFeature(9, 7, 6, 2);
        double node4 = -0.7706244791086947 * node6;
        double node3 = node4 + 7.0;
        double node12 = image.getOneRectangleFeature(8, 2, 2, 6);
        double node2 = node3 + node12;
        double node17 = image.getThreeRectangleFeature(1, 8, 4, 5, 2);
        boolean node1 = node2 < node17;
        return (int) (node1? 2 : 1);
	}

}


