/** * Construct a new feature * * @param rects * @param correctionFactor */ private HaarFeature(WeightedRectangle[] rects, final float correctionFactor) { this.rects = rects; this.correctionFactor = correctionFactor; cachedRects = new WeightedRectangle[rects.length]; for (int i = 0; i < cachedRects.length; i++) { cachedRects[i] = new WeightedRectangle(0, 0, 0, 0, 0); } }
regions.add(WeightedRectangle.parse(reader.nextText()));
regions.add(WeightedRectangle.parse(reader.nextText()));
/** * Construct a new feature * * @param rects * @param correctionFactor */ private HaarFeature(WeightedRectangle[] rects, final float correctionFactor) { this.rects = rects; this.correctionFactor = correctionFactor; cachedRects = new WeightedRectangle[rects.length]; for (int i = 0; i < cachedRects.length; i++) { cachedRects[i] = new WeightedRectangle(0, 0, 0, 0, 0); } }
/** * parse a string of the form "x y width height weight" to construct a * WeightedRectangle. * * @param str * the string to parse * @return the constructed WeightedRectangle */ public static WeightedRectangle parse(String str) { final String[] parts = str.trim().split(" "); final int x = Integer.parseInt(parts[0]); final int y = Integer.parseInt(parts[1]); final int width = Integer.parseInt(parts[2]); final int height = Integer.parseInt(parts[3]); final float weight = Float.parseFloat(parts[4]); return new WeightedRectangle(x, y, width, height, weight); } }
/** * parse a string of the form "x y width height weight" to construct a * WeightedRectangle. * * @param str * the string to parse * @return the constructed WeightedRectangle */ public static WeightedRectangle parse(String str) { final String[] parts = str.trim().split(" "); final int x = Integer.parseInt(parts[0]); final int y = Integer.parseInt(parts[1]); final int width = Integer.parseInt(parts[2]); final int height = Integer.parseInt(parts[3]); final float weight = Float.parseFloat(parts[4]); return new WeightedRectangle(x, y, width, height, weight); } }
rects[0] = new WeightedRectangle(x0, y0, w0, h0, wt0); rects[1] = new WeightedRectangle(x1, y1, w1, h1, wt1); rects[2] = new WeightedRectangle(x2, y2, w2, h2, wt2);
rects[0] = new WeightedRectangle(x0, y0, w0, h0, wt0); rects[1] = new WeightedRectangle(x1, y1, w1, h1, wt1); rects[2] = new WeightedRectangle(x2, y2, w2, h2, wt2);
rects[0] = new WeightedRectangle(x0, y0, w0, h0, wt0); rects[1] = new WeightedRectangle(x1, y1, w1, h1, wt1);
rects[0] = new WeightedRectangle(x0, y0, w0, h0, wt0); rects[1] = new WeightedRectangle(x1, y1, w1, h1, wt1);