SkinSegmenter.java
package ac.essex.ooechs.imaging.commons.segmentation.demos;
import ac.essex.ooechs.imaging.commons.segmentation.Segmenter;
import ac.essex.ooechs.imaging.commons.PixelLoader;
/**
* Looks at a colour image, and roughly differentiates the parts which contain human skin
* and those which dont. This program was learned using Genetic Programming. It uses
* only methods available from the standard PixelLoader object.
*/
public class SkinSegmenter extends Segmenter {
public static final int NOT_SKIN = 1;
public static final int SKIN = 2;
public int segment(PixelLoader image, int x, int y) {
boolean node1 = image.getGreen(x, y) < image.getLightness(x, y);
double node6 = image.getBlue(x, y) + image.getPerimeter2().getStatistics(image, x, y).getStandardDeviation();
boolean node5 = node6 < image.getRed(x, y);
boolean node11 = image.getPerimeter2().getStatistics(image, x, y).getStandardDeviation() < image.getGreen(x, y);
double node10 = node11? 2 : 1;
double node4 = node5? node10 : 1;
return (int) (node1? node4 : 1);
}
}