Loading src/main/java/object_detection/types/BoundingBox.java +3 −1 Original line number Diff line number Diff line Loading @@ -2,11 +2,12 @@ package object_detection.types; public class BoundingBox { public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl){ public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl, int idx){ this.topRight = tr; this.topLeft = tl; this.botRight = br; this.botLeft = bl; this.idx = idx; } public boolean within(Point2D p){ Loading @@ -22,6 +23,7 @@ public class BoundingBox { Point2D topLeft; Point2D botRight; Point2D botLeft; int idx; } src/main/java/object_detection/types/ObjectSet.java +41 −11 Original line number Diff line number Diff line Loading @@ -85,20 +85,50 @@ public class ObjectSet { * @param featCsv : file containing each feature in space (x,y,z and index) * @param bboxCsv : file containing Bounding Boxes for each object in a keyframe */ public void processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // first we need to extract the features and blackbox from the corresponding CSVs ArrayList<Point> feature; ArrayList<BoundingBox> bbox; public List<ArrayList<Point>> processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // Read bounding boxes List<BoundingBox> boundingBoxes = readBoundingBoxes(bboxCsv); Scanner sc = new Scanner(featCsv); sc.useDelimiter("\n"); while(sc.hasNext()){ String[] cl = sc.next().split(","); // Initialize results structure List<ArrayList<Point>> results = new ArrayList<>(); for (int i = 0; i < boundingBoxes.size(); i++) { results.add(new ArrayList<>()); } //Point p = new Point(cl[4], cl[5], cl[6]); // Process feature points Scanner scanner = new Scanner(featCsv); while (scanner.hasNextLine()) { String[] line = scanner.nextLine().split(","); Point2D point2D = new Point2D(Float.parseFloat(line[0]), Float.parseFloat(line[1]), Integer.parseInt(line[2])); Point point = new Point(Float.parseFloat(line[3]), Float.parseFloat(line[4]), Float.parseFloat(line[5]), Integer.parseInt(line[2])); // Check if the point is within any bounding box for (int i = 0; i < boundingBoxes.size(); i++) { if (boundingBoxes.get(i).within(point2D)) { results.get(i).add(point); break; // Assuming a point belongs to only one bounding box } } } scanner.close(); return results; } private List<BoundingBox> readBoundingBoxes(File bboxCsv) throws FileNotFoundException { List<BoundingBox> boxes = new ArrayList<>(); Scanner scanner = new Scanner(bboxCsv); scanner.nextLine(); // Skip header while (scanner.hasNextLine()) { String[] line = scanner.nextLine().split(","); Point2D tr = new Point2D(Float.parseFloat(line[2]) + Float.parseFloat(line[4]), Float.parseFloat(line[3]), 0); Point2D tl = new Point2D(Float.parseFloat(line[2]), Float.parseFloat(line[3]), 0); Point2D br = new Point2D(Float.parseFloat(line[2]) + Float.parseFloat(line[4]), Float.parseFloat(line[3]) + Float.parseFloat(line[5]), 0); Point2D bl = new Point2D(Float.parseFloat(line[2]), Float.parseFloat(line[3]) + Float.parseFloat(line[5]), 0); boxes.add(new BoundingBox(tr, tl, br, bl, Integer.parseInt(line[0]))); } scanner.close(); return boxes; } } No newline at end of file src/main/java/object_detection/types/Point.java +7 −3 Original line number Diff line number Diff line Loading @@ -9,18 +9,18 @@ public class Point { private float x; private float y; private float z; final int idx; private int idx; // METHODS /* Object Constructor of a feature in 3D */ public Point(float xx, float yy, float zz){ public Point(float xx, float yy, float zz, int idx){ this.x = xx; this.y = yy; this.z = zz; this.idx = count++; this.idx = idx; } /** Loading Loading @@ -64,4 +64,8 @@ public class Point { public float getZ() { return z; } public int getIdx() { return idx; } } src/main/java/object_detection/types/Point2D.java +7 −1 Original line number Diff line number Diff line Loading @@ -4,10 +4,12 @@ public class Point2D { private float x; private float y; private int idx; public Point2D(float x, float y){ public Point2D(float x, float y, int idx){ this.x = x; this.y = y; this.idx = idx; } public float getY() { Loading @@ -17,4 +19,8 @@ public class Point2D { public float getX() { return x; } public int getIdx() { return idx; } } target/classes/README.md 0 → 100644 +15 −0 Original line number Diff line number Diff line # Entry into System Things that are true: 1. A student should be able to build the system, then press run, then open a localhost and see the video and the point cloud of each object 2. A student should also be able to choose between different object and get information (need interactive display) 3. The entry needs to do the entire workflow - get keyframes and featurepoints - get objects from keyframes - start object detection - finish object detection and update database - ping GUI server - GUI server pulls information and displays point cloud to user TODO: function to process each frame within the ObjectSet No newline at end of file Loading
src/main/java/object_detection/types/BoundingBox.java +3 −1 Original line number Diff line number Diff line Loading @@ -2,11 +2,12 @@ package object_detection.types; public class BoundingBox { public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl){ public BoundingBox(Point2D tr, Point2D tl, Point2D br, Point2D bl, int idx){ this.topRight = tr; this.topLeft = tl; this.botRight = br; this.botLeft = bl; this.idx = idx; } public boolean within(Point2D p){ Loading @@ -22,6 +23,7 @@ public class BoundingBox { Point2D topLeft; Point2D botRight; Point2D botLeft; int idx; }
src/main/java/object_detection/types/ObjectSet.java +41 −11 Original line number Diff line number Diff line Loading @@ -85,20 +85,50 @@ public class ObjectSet { * @param featCsv : file containing each feature in space (x,y,z and index) * @param bboxCsv : file containing Bounding Boxes for each object in a keyframe */ public void processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // first we need to extract the features and blackbox from the corresponding CSVs ArrayList<Point> feature; ArrayList<BoundingBox> bbox; public List<ArrayList<Point>> processFrame(File featCsv, File bboxCsv) throws FileNotFoundException { // Read bounding boxes List<BoundingBox> boundingBoxes = readBoundingBoxes(bboxCsv); Scanner sc = new Scanner(featCsv); sc.useDelimiter("\n"); while(sc.hasNext()){ String[] cl = sc.next().split(","); // Initialize results structure List<ArrayList<Point>> results = new ArrayList<>(); for (int i = 0; i < boundingBoxes.size(); i++) { results.add(new ArrayList<>()); } //Point p = new Point(cl[4], cl[5], cl[6]); // Process feature points Scanner scanner = new Scanner(featCsv); while (scanner.hasNextLine()) { String[] line = scanner.nextLine().split(","); Point2D point2D = new Point2D(Float.parseFloat(line[0]), Float.parseFloat(line[1]), Integer.parseInt(line[2])); Point point = new Point(Float.parseFloat(line[3]), Float.parseFloat(line[4]), Float.parseFloat(line[5]), Integer.parseInt(line[2])); // Check if the point is within any bounding box for (int i = 0; i < boundingBoxes.size(); i++) { if (boundingBoxes.get(i).within(point2D)) { results.get(i).add(point); break; // Assuming a point belongs to only one bounding box } } } scanner.close(); return results; } private List<BoundingBox> readBoundingBoxes(File bboxCsv) throws FileNotFoundException { List<BoundingBox> boxes = new ArrayList<>(); Scanner scanner = new Scanner(bboxCsv); scanner.nextLine(); // Skip header while (scanner.hasNextLine()) { String[] line = scanner.nextLine().split(","); Point2D tr = new Point2D(Float.parseFloat(line[2]) + Float.parseFloat(line[4]), Float.parseFloat(line[3]), 0); Point2D tl = new Point2D(Float.parseFloat(line[2]), Float.parseFloat(line[3]), 0); Point2D br = new Point2D(Float.parseFloat(line[2]) + Float.parseFloat(line[4]), Float.parseFloat(line[3]) + Float.parseFloat(line[5]), 0); Point2D bl = new Point2D(Float.parseFloat(line[2]), Float.parseFloat(line[3]) + Float.parseFloat(line[5]), 0); boxes.add(new BoundingBox(tr, tl, br, bl, Integer.parseInt(line[0]))); } scanner.close(); return boxes; } } No newline at end of file
src/main/java/object_detection/types/Point.java +7 −3 Original line number Diff line number Diff line Loading @@ -9,18 +9,18 @@ public class Point { private float x; private float y; private float z; final int idx; private int idx; // METHODS /* Object Constructor of a feature in 3D */ public Point(float xx, float yy, float zz){ public Point(float xx, float yy, float zz, int idx){ this.x = xx; this.y = yy; this.z = zz; this.idx = count++; this.idx = idx; } /** Loading Loading @@ -64,4 +64,8 @@ public class Point { public float getZ() { return z; } public int getIdx() { return idx; } }
src/main/java/object_detection/types/Point2D.java +7 −1 Original line number Diff line number Diff line Loading @@ -4,10 +4,12 @@ public class Point2D { private float x; private float y; private int idx; public Point2D(float x, float y){ public Point2D(float x, float y, int idx){ this.x = x; this.y = y; this.idx = idx; } public float getY() { Loading @@ -17,4 +19,8 @@ public class Point2D { public float getX() { return x; } public int getIdx() { return idx; } }
target/classes/README.md 0 → 100644 +15 −0 Original line number Diff line number Diff line # Entry into System Things that are true: 1. A student should be able to build the system, then press run, then open a localhost and see the video and the point cloud of each object 2. A student should also be able to choose between different object and get information (need interactive display) 3. The entry needs to do the entire workflow - get keyframes and featurepoints - get objects from keyframes - start object detection - finish object detection and update database - ping GUI server - GUI server pulls information and displays point cloud to user TODO: function to process each frame within the ObjectSet No newline at end of file