Skip to content
Snippets Groups Projects
Unverified Commit f896e036 authored by Patrick Hammer's avatar Patrick Hammer Committed by GitHub
Browse files

Merge pull request #37 from opennars/HigherResolution1

Higher resolution1
parents 82e0e379 58bedda5
No related branches found
No related tags found
No related merge requests found
...@@ -34,6 +34,7 @@ public class Entity { ...@@ -34,6 +34,7 @@ public class Entity {
public static int entityID = 0; public static int entityID = 0;
public String label = ""; public String label = "";
public double posX, posY; public double posX, posY;
public double width, height;
public double getPosX() { public double getPosX() {
return posX; return posX;
} }
...@@ -47,11 +48,8 @@ public class Entity { ...@@ -47,11 +48,8 @@ public class Entity {
public float maxSpeed = 2.0f; public float maxSpeed = 2.0f;
public static boolean pedestrianIgnoreTrafficLight = false; public static boolean pedestrianIgnoreTrafficLight = false;
public static boolean carIgnoreTrafficLight = false; public static boolean carIgnoreTrafficLight = false;
public double normalness = 0.0; public double normalness = 0.0;
public boolean isPredicted = false; public boolean isPredicted = false;
public double lastPosX = 0; public double lastPosX = 0;
public double lastPosY = 0; public double lastPosY = 0;
...@@ -130,7 +128,14 @@ public class Entity { ...@@ -130,7 +128,14 @@ public class Entity {
} }
} }
if(!isPredicted) { if(!isPredicted) {
applet.ellipse(2.5f, 2.5f, Util.discretization*scale, Util.discretization*scale); //applet.rect((float) (0.0f-width/2.0f), (float) (0.0f-height/2.0f), (float) width, (float) height);
float mul2 = 2.0f;
if(RealCrossing.running) {
applet.ellipse(2.5f, 2.5f, Util.discretization*scale*mul2, Util.discretization*scale*mul2);
} else {
applet.ellipse(2.5f, 2.5f, Util.discretization*scale, Util.discretization*scale);
}
} }
if(RealCrossing.running) { if(RealCrossing.running) {
......
...@@ -218,6 +218,9 @@ public class RealCrossing extends PApplet { ...@@ -218,6 +218,9 @@ public class RealCrossing extends PApplet {
} }
Integer X = Integer.valueOf(unwrap(props[3])); Integer X = Integer.valueOf(unwrap(props[3]));
Integer Y = Integer.valueOf(unwrap(props[4])); Integer Y = Integer.valueOf(unwrap(props[4]));
Integer width = Integer.valueOf(unwrap(props[5]));
Integer height = Integer.valueOf(unwrap(props[6]));
Integer X2 = Integer.valueOf(unwrap(props[19])); //7 6 Integer X2 = Integer.valueOf(unwrap(props[19])); //7 6
Integer Y2 = Integer.valueOf(unwrap(props[20])); Integer Y2 = Integer.valueOf(unwrap(props[20]));
...@@ -229,26 +232,37 @@ public class RealCrossing extends PApplet { ...@@ -229,26 +232,37 @@ public class RealCrossing extends PApplet {
if(Y < Y2) { if(Y < Y2) {
id += 1; id += 1;
} }
double angle = Math.atan2(Y - Y2, X - X2);
double movement = Math.sqrt((X-X2)*(X-X2) + (Y - Y2)*(Y - Y2)); double movement = Math.sqrt((X-X2)*(X-X2) + (Y - Y2)*(Y - Y2));
if(props[0].equals("0")) { //person or vehicle for now if(props[0].equals("0")) { //person or vehicle for now
if(movement < (double)movementThresholdPedestrian) { if(movement < (double)movementThresholdPedestrian) {
continue; continue;
} }
Pedestrian toAdd = new Pedestrian(id, X, Y, 0, 0, label); Pedestrian toAdd = new Pedestrian(id, X2, Y2, 0, 0, label);
toAdd.width = width;
toAdd.height = height;
//toAdd.angle = angle;
entities.add(toAdd); entities.add(toAdd);
} else { } else {
if(!props[0].equals("1")) { if(!props[0].equals("1")) {
if(movement < (double)movementThresholdCar) { if(movement < (double)movementThresholdCar) {
continue; continue;
} }
Car toAdd = new Car(id, X, Y, 0, 0, label); Car toAdd = new Car(id, X2, Y2, 0, 0, label);
toAdd.width = width;
toAdd.height = height;
//toAdd.angle = angle;
entities.add(toAdd); entities.add(toAdd);
} else { } else {
if(movement < (double)movementThresholdBike) { if(movement < (double)movementThresholdBike) {
continue; continue;
} }
Bike toAdd = new Bike(id, X, Y, 0, 0, label); Bike toAdd = new Bike(id, X2, Y2, 0, 0, label);
toAdd.width = width;
toAdd.height = height;
//toAdd.angle = angle;
entities.add(toAdd); entities.add(toAdd);
} }
} }
...@@ -329,7 +343,7 @@ public class RealCrossing extends PApplet { ...@@ -329,7 +343,7 @@ public class RealCrossing extends PApplet {
//</editor-fold> //</editor-fold>
System.out.println("args: videopath trackletpath [discretization movementThreshold]"); System.out.println("args: videopath trackletpath [discretization movementThreshold]");
System.out.println("example: java -cp \"*\" org.opennars.applications.crossing.RealCrossing /mnt/sda1/Users/patha/Downloads/Test/Test/Test001/ /home/tc/Dateien/CROSSING/Test001/ 100 10"); System.out.println("example: java -cp \"*\" org.opennars.applications.crossing.RealCrossing /mnt/sda1/Users/patha/Downloads/Test/Test/Test001/ /home/tc/Dateien/CROSSING/Test001/ 100 10");
Util.discretization = 100; Util.discretization = 50;
if(args.length == 2) { if(args.length == 2) {
RealCrossing.videopath = args[0]; RealCrossing.videopath = args[0];
RealCrossing.trackletpath = args[1]; RealCrossing.trackletpath = args[1];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment