Loading src/main/java/object_detection/ObjectDetector.java +22 −9 Original line number Diff line number Diff line package object_detection; import object_detection.types.ObjectSet; import object_detection.types.Point; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class ObjectDetector { Loading @@ -9,10 +14,25 @@ public class ObjectDetector { static ObjectSet os; public static void run() throws IOException { System.out.println("Running object detection"); System.out.println("Running object detection:"); ObjectDetector.main(null); } public static void processFrame(String framename) throws FileNotFoundException { // 1) we get the feature points, store as an Scanner sc = new Scanner(new File(framename)); sc.useDelimiter("\n"); // 2) we map each point to an object using the bounding boxes double[][] box1 = {{1, 2}, {3, 4}}; System.out.println(Arrays.deepToString(box1)); // 3) } public static void main(String[] args) throws IOException { /* infinite loop of running system: Loading @@ -24,14 +44,7 @@ public class ObjectDetector { // create objectset os = new ObjectSet(); // get data from keyframe Scanner sc = new Scanner(new File("src/main/java/vslam/KeyFramePoints/KeyFramePoints_0003.csv")); sc.useDelimiter("\n"); while(sc.hasNext()){ System.out.println(sc.next()); } sc.close(); processFrame("src/main/java/vslam/KeyFramePoints/KeyFramePoints_0003.csv"); // Add two test sets int o1 = os.makeObject( Loading src/main/java/object_detection/types/BoundingBox.java 0 → 100644 +27 −0 Original line number Diff line number Diff line package object_detection.types; public class BoundingBox { public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl){ this.topRight = tr; this.topLeft = tl; this.botRight = br; this.botLeft = bl; } public boolean within(Point2D p){ return p.getX() < this.topRight.getX() && p.getX() > this.topLeft.getX() && p.getY() < this.topLeft.getY() && p.getY() > this.botLeft.getY(); } // members Point2D topRight; Point2D topLeft; Point2D botRight; Point2D botLeft; } src/main/java/object_detection/ObjectSet.java→src/main/java/object_detection/types/ObjectSet.java +3 −3 Original line number Diff line number Diff line package object_detection; package object_detection.types; import java.util.*; public class ObjectSet { static List<PointSet> objects; public static List<PointSet> objects; static int count = 0; public ObjectSet(){ objects = new ArrayList<>(); Loading src/main/java/object_detection/Point.java→src/main/java/object_detection/types/Point.java +12 −1 Original line number Diff line number Diff line package object_detection; package object_detection.types; public class Point { Loading Loading @@ -53,4 +53,15 @@ public class Point { return "Point(" + this.x + " ," + this.y + " ," + this.z + ")"; } public float getY() { return y; } public float getX() { return x; } public float getZ() { return z; } } src/main/java/object_detection/types/Point2D.java 0 → 100644 +20 −0 Original line number Diff line number Diff line package object_detection.types; public class Point2D { private float x; private float y; public Point2D(float x, float y){ this.x = x; this.y = y; } public float getY() { return y; } public float getX() { return x; } } Loading
src/main/java/object_detection/ObjectDetector.java +22 −9 Original line number Diff line number Diff line package object_detection; import object_detection.types.ObjectSet; import object_detection.types.Point; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class ObjectDetector { Loading @@ -9,10 +14,25 @@ public class ObjectDetector { static ObjectSet os; public static void run() throws IOException { System.out.println("Running object detection"); System.out.println("Running object detection:"); ObjectDetector.main(null); } public static void processFrame(String framename) throws FileNotFoundException { // 1) we get the feature points, store as an Scanner sc = new Scanner(new File(framename)); sc.useDelimiter("\n"); // 2) we map each point to an object using the bounding boxes double[][] box1 = {{1, 2}, {3, 4}}; System.out.println(Arrays.deepToString(box1)); // 3) } public static void main(String[] args) throws IOException { /* infinite loop of running system: Loading @@ -24,14 +44,7 @@ public class ObjectDetector { // create objectset os = new ObjectSet(); // get data from keyframe Scanner sc = new Scanner(new File("src/main/java/vslam/KeyFramePoints/KeyFramePoints_0003.csv")); sc.useDelimiter("\n"); while(sc.hasNext()){ System.out.println(sc.next()); } sc.close(); processFrame("src/main/java/vslam/KeyFramePoints/KeyFramePoints_0003.csv"); // Add two test sets int o1 = os.makeObject( Loading
src/main/java/object_detection/types/BoundingBox.java 0 → 100644 +27 −0 Original line number Diff line number Diff line package object_detection.types; public class BoundingBox { public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl){ this.topRight = tr; this.topLeft = tl; this.botRight = br; this.botLeft = bl; } public boolean within(Point2D p){ return p.getX() < this.topRight.getX() && p.getX() > this.topLeft.getX() && p.getY() < this.topLeft.getY() && p.getY() > this.botLeft.getY(); } // members Point2D topRight; Point2D topLeft; Point2D botRight; Point2D botLeft; }
src/main/java/object_detection/ObjectSet.java→src/main/java/object_detection/types/ObjectSet.java +3 −3 Original line number Diff line number Diff line package object_detection; package object_detection.types; import java.util.*; public class ObjectSet { static List<PointSet> objects; public static List<PointSet> objects; static int count = 0; public ObjectSet(){ objects = new ArrayList<>(); Loading
src/main/java/object_detection/Point.java→src/main/java/object_detection/types/Point.java +12 −1 Original line number Diff line number Diff line package object_detection; package object_detection.types; public class Point { Loading Loading @@ -53,4 +53,15 @@ public class Point { return "Point(" + this.x + " ," + this.y + " ," + this.z + ")"; } public float getY() { return y; } public float getX() { return x; } public float getZ() { return z; } }
src/main/java/object_detection/types/Point2D.java 0 → 100644 +20 −0 Original line number Diff line number Diff line package object_detection.types; public class Point2D { private float x; private float y; public Point2D(float x, float y){ this.x = x; this.y = y; } public float getY() { return y; } public float getX() { return x; } }