protected ConnectedComponent c(FImage mask) { return new ConnectedComponent(mask, 0.5f); }
protected ConnectedComponent c(FImage mask) { return new ConnectedComponent(mask, 0.5f); }
protected ConnectedComponent getConnectedComponent(DetectedFace df) { if (df instanceof CCDetectedFace) { return ((CCDetectedFace) df).connectedComponent; } else { return new ConnectedComponent(df.getBounds()); } }
private static boolean isCentred(Set<Pixel> support) { final ConnectedComponent cc = new ConnectedComponent(support); final Pixel cp = cc.calculateCentroidPixel(); return cp.x == 0 && cp.y == 0; }
private static boolean isCentred(Set<Pixel> support) { final ConnectedComponent cc = new ConnectedComponent(support); final Pixel cp = cc.calculateCentroidPixel(); return cp.x == 0 && cp.y == 0; }
/** * Calculate the ratio of the area of the given polygon to the area of this * connected component. This does not consider whether the areas overlap. * * @param ch * The polygon to test again. * @return The area ratio of the given polygon to this connected component. */ public double calculateAreaRatio(Polygon ch) { return calculateAreaRatio(new ConnectedComponent(ch)); }
/** * Calculate the ratio of the area of the given polygon to the area of this * connected component. This does not consider whether the areas overlap. * * @param ch * The polygon to test again. * @return The area ratio of the given polygon to this connected component. */ public double calculateAreaRatio(Polygon ch) { return calculateAreaRatio(new ConnectedComponent(ch)); }
/** * Render the components to the image with randomly assigned colours. * * @param image * Image to draw to * @param components * the components * @return the image */ public static MBFImage renderSegments(MBFImage image, List<? extends PixelSet> components) { for (final PixelSet cc : components) { final BlobRenderer<Float[]> br = new BlobRenderer<Float[]>(image, RGBColour.randomColour()); br.process(new ConnectedComponent(cc.pixels)); } return image; }
currentComponent = new ConnectedComponent(); components.add(currentComponent);
/** * Render the components to the image with randomly assigned colours. * * @param image * Image to draw to * @param components * the components * @return the image */ public static MBFImage renderSegments(MBFImage image, List<? extends PixelSet> components) { for (final PixelSet cc : components) { final BlobRenderer<Float[]> br = new BlobRenderer<Float[]>(image, RGBColour.randomColour()); br.process(new ConnectedComponent(cc.pixels)); } return image; }
currentComponent = new ConnectedComponent(); components.add(currentComponent);
public void process(ConnectedComponent cc) { Polygon ch = cc.calculateConvexHull(); ConnectedComponent chcc = new ConnectedComponent(ch);
public void process(ConnectedComponent cc) { Polygon ch = cc.calculateConvexHull(); ConnectedComponent chcc = new ConnectedComponent(ch);
public void process(ConnectedComponent cc) { Polygon ch = cc.calculateConvexHull(); ConnectedComponent chcc = new ConnectedComponent(ch);
public void process(ConnectedComponent cc) { Polygon ch = cc.calculateConvexHull(); ConnectedComponent chcc = new ConnectedComponent(ch);
@Override public void process(ConnectedComponent cc) { area = cc.calculateArea(); final double[] c = cc.calculateCentroid(); cx = c[0]; cy = c[1]; direction = cc.calculateDirection(); elongatedness = cc.calculateOrientatedBoundingBoxAspectRatio(); final float edge_length = cc.getOuterBoundary().size(); compactness = (edge_length * edge_length) / new ConnectedComponent(cc.toPolygon()).calculateArea(); if (area > 4) chfit = new ConnectedComponent(cc.toPolygon()).calculatePercentageConvexHullFit(); // chfit // won't // work // for // really // small // regions else chfit = 1; if (area > 100) cornerEst = cc.estimateNumberOfVertices(3, 10); else cornerEst = area; }
@Override public void process(ConnectedComponent cc) { area = cc.calculateArea(); final double[] c = cc.calculateCentroid(); cx = c[0]; cy = c[1]; direction = cc.calculateDirection(); elongatedness = cc.calculateOrientatedBoundingBoxAspectRatio(); final float edge_length = cc.getOuterBoundary().size(); compactness = (edge_length * edge_length) / new ConnectedComponent(cc.toPolygon()).calculateArea(); if (area > 4) chfit = new ConnectedComponent(cc.toPolygon()).calculatePercentageConvexHullFit(); // chfit // won't // work // for // really // small // regions else chfit = 1; if (area > 100) cornerEst = cc.estimateNumberOfVertices(3, 10); else cornerEst = area; }
final ConnectedComponent cc = new ConnectedComponent(pixels); components.add(cc);
components.add(new ConnectedComponent(pixels));
components.add(new ConnectedComponent(pixels));