public PShape createShape(int kind, float... p) { return intf.app.createShape(kind, p); }
public PShape createShape(int type) { return intf.app.createShape(type); }
public PShape createShape() { return intf.app.createShape(); }
static protected PShape createShape(PApplet parent, PShape src) { PShape dest = null; if (src.family == GROUP) { dest = parent.createShape(GROUP); PShape.copyGroup(parent, src, dest); } else if (src.family == PRIMITIVE) { dest = parent.createShape(src.kind, src.params); PShape.copyPrimitive(src, dest); } else if (src.family == GEOMETRY) { dest = parent.createShape(src.kind); PShape.copyGeometry(src, dest); } else if (src.family == PATH) { dest = parent.createShape(PATH); PShape.copyPath(src, dest); } dest.setName(src.name); return dest; }
static protected PShape createShape(PApplet parent, PShape src) { PShape dest = null; if (src.family == GROUP) { dest = parent.createShape(GROUP); PShape.copyGroup(parent, src, dest); } else if (src.family == PRIMITIVE) { dest = parent.createShape(src.kind, src.params); PShape.copyPrimitive(src, dest); } else if (src.family == GEOMETRY) { dest = parent.createShape(src.kind); PShape.copyGeometry(src, dest); } else if (src.family == PATH) { dest = parent.createShape(PATH); PShape.copyPath(src, dest); } dest.setName(src.name); return dest; }
/** * Detect faces using {@link HaarCascadeDetector}, return an {@link ArrayList} of * {@link PShape} instances. Note the {@link PShape} instances have no fill and * a colour: 255,0,0 * @return detected faces */ public ArrayList<PShape> faces(){ ArrayList<PShape> faces = new ArrayList<PShape>(); List<DetectedFace> detected = faceDetector.detectFaces(oiImage.flatten()); for (DetectedFace detectedFace : detected) { Rectangle bounds = detectedFace.getBounds(); PShape detectedPShape = this.parent.createShape(RECT,bounds.x,bounds.y,bounds.width,bounds.height); detectedPShape.setFill(false); detectedPShape.setStroke(this.parent.color(255f, 0, 0)); faces.add(detectedPShape); } return faces; } }