Commit ac07cc80 authored by Rohan  Kumar's avatar Rohan Kumar
Browse files

could be working now

parent e8064ae4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ public class ObjectDetector {

        // printing final object set for sanity
        System.out.println(objSet);
        System.out.println("====> Finished Object Mapping");
    }

    /**
+13 −22
Original line number Diff line number Diff line
@@ -47,24 +47,21 @@ public class ObjectSet {
        Point[] r1 = this.objects.get(i).getPoints();
        Point[] r2 = this.objects.get(j).getPoints();

        // O(n)
        Set<Point> s = new HashSet<>();
        for(Point r : r1){
            if(r != null){
                s.add(r);
            }
        }

        // O(n)
        int count = 0;
        for(Point p : r2){
            if(p!=null && s.contains(p)){

        // O(n^2)
        for (Point point : r1) {
            for (Point value : r2) {
                if (point.equals(value)) {
                    // we found point r1[x], now find next, and so on
                    count++;
                    break;
                }
            }
        }

        // in this line, if the reps are 80% similar, assume this is the same set.
        return (count) > (r1.length*0.8);
        // in this line, if the reps are 20% similar, assume this is the same set.
        return (count) > (Math.max(r1.length, r2.length)*0.1);
    }

    /**
@@ -93,7 +90,7 @@ public class ObjectSet {
    
    public List<ArrayList<Point>> processFrame(File featCsv, File bboxCsv) throws FileNotFoundException {
        // Print the name of the file being processed
        System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName());
        //System.out.println("Processing " + featCsv.getName() + " and " + bboxCsv.getName());

        // Read bounding boxes
        List<BoundingBox> boundingBoxes = readBoundingBoxes(bboxCsv);
@@ -150,7 +147,6 @@ public class ObjectSet {
                    continue;
                }
                if (compareObjects(objIdx, j)) {
                    System.out.println("COMBINING");
                    combineObjects(j, objIdx);
                    break;
                }
@@ -193,11 +189,6 @@ public class ObjectSet {
     */
    @Override
    public String toString(){
        StringBuilder res = new StringBuilder("ObjectSet:");
        for(PointSet p : this.objects){
            res.append("\n\t - Object with ").append(p.pset.size()).append(" points");
        }

        return res.toString();
        return "ObjectSet of : " + this.objects.size() + " objects";
    }
}
 No newline at end of file
Loading