- // @Override
- // public String toString() {
- // StringBuilder sb = new StringBuilder();
- // sb.append("Classifier [ScanAreas: " + this.scanAreas.length);
- // int yesNo = this.possibilityFaceYes + this.possibilityFaceNo;
- // sb.append(String.format("|Yes: %3.2f| No:%3.2f] (",
- // (this.possibilityFaceYes / (float) yesNo) * 100.0f,
- // (this.possibilityFaceNo / (float) yesNo) * 100.0f));
- // for (int i = 0; i < this.scanAreas.length; ++i) {
- // sb.append(String.format("[%3d|Yes: %3.2f| No: %3.2f], ", i + 1,
- // (this.possibilities_FaceYes[i] * 100.0f), (this.possibilities_FaceNo[i] *
- // 100.0f)));
- // }
- // sb.append(")");
- //
- // return sb.toString();
- // }
-
- /**
- * Generates a new set of classifiers each with more ScanAreas than the last
- * classifier. You can specifiy the amount of classifiers you want to generate
- *
- * @param amount
- * amount of classifiers to create
- * @param startAmountScanAreas
- * the start amount of scanAreas - if your first classifiers should
- * contain 3 items you should give 3 here
- * @param incAmountScanAreas
- * the amount of which the scanAreas should increase - a simple 2
- * will increase them by 2 every step
- * @return a List of classifiers
- */
- // public static List<Classifier> generateNewClassifiers(int amount, int
- // startAmountScanAreas,
- // float incAmountScanAreas) {
- // List<Classifier> classifiers = new ArrayList<Classifier>();
- //
- // int maxDim = 40;
- // Random random = new Random(System.currentTimeMillis());
- // double maxSpace = 2 * Math.PI * Math.pow(50, 2);
- //
- // for (int i = 0; i < amount; ++i) {
- // // we create an odd amount of ScanAreas starting with 1 (3, 5, 7, ...)
- // int scanAreaAmount = startAmountScanAreas + (int)
- // Math.pow(incAmountScanAreas, i);// +
- // // ((i)*incAmountScanAreas+1);
- //
- // int scanAreaSize =
- // randomInt(random, scanAreaAmount * 20, (int) Math.min(maxDim * maxDim,
- // maxSpace))
- // / scanAreaAmount;
- // // System.out.println("scanAreaSize = "+scanAreaSize);
- //
- // List<ScanArea> scanAreas = new ArrayList<ScanArea>();
- //
- // for (int j = 0; j < scanAreaAmount; ++j) {
- //
- // int counter = 0;
- // ScanArea scanArea = null;
- // do {
- // // new the width has the first choice
- // int minWidth = (int) Math.ceil(scanAreaSize / (float) maxDim);
- //
- // int scanAreaWidth = randomInt(random, minWidth, Math.min(maxDim,
- // scanAreaSize / 2));
- // int scanAreaHeight = (int) Math.ceil(scanAreaSize / (float) scanAreaWidth);
- //
- // int radius =
- // randomInt(random, 5, Math.min(50 - scanAreaHeight / 2, 50 - scanAreaWidth /
- // 2));
- // double angle = random.nextFloat() * 2 * Math.PI;
- //
- // int posX = (int) (50 + Math.cos(angle) * radius) - (scanAreaWidth / 2);
- // int posY = (int) (50 + Math.sin(angle) * radius) - (scanAreaHeight / 2);
- //
- // // System.out.println("[Angle: "+(angle /
- // // (Math.PI*2)*180)+" | radius: "+radius+"]");
- // //
- // System.out.println("Area"+j+" is "+posX+", "+posY+" ("+scanAreaWidth+" x "+scanAreaHeight+" = "+((scanAreaWidth*scanAreaHeight))+")");
- //
- // // now we get random position for this area
- // scanArea = new ScanArea(posX, posY, scanAreaWidth, scanAreaHeight);
- //
- // counter++;
- // } while (scanAreas.contains(scanArea) && counter < 30);
- //
- // if (counter == 30) {
- // j -= 1;
- // continue;
- // }
- //
- // scanAreas.add(scanArea);
- // }
- //
- // Classifier classifier = new Classifier(scanAreas.toArray(new ScanArea[0]));
- // classifiers.add(classifier);
- // }
- //
- // return classifiers;
- // }
-
- // private static int randomInt(Random random, int from, int to) {
- // if (to - from <= 0)
- // to = from + 1;
- // return from + random.nextInt(to - from);
- // }
- //
- // public static List<Classifier> getDefaultClassifier() {
- // List<Classifier> classifier = new ArrayList<Classifier>();
- //
- // classifier.add(new Classifier(new ScanArea(30, 30, 30, 30), new
- // ScanArea(15, 8, 15, 82),
- // new ScanArea(75, 8, 15, 82)));
- //
- // return classifier;
- // }