Version 27.11 ("fertiger" Tracker)
This commit is contained in:
parent
40229f479a
commit
c2b5dc7e96
32
.idea/workspace.xml
generated
32
.idea/workspace.xml
generated
@ -4,9 +4,8 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4d75e996-cee4-4ec6-b802-5b56d0c0eac4" name="Changes" comment="Version 23.11 (Grafics update)">
|
||||
<list default="true" id="4d75e996-cee4-4ec6-b802-5b56d0c0eac4" name="Changes" comment="Version 27.11">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/GraphicsProgram.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GraphicsProgram.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/Tracker.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Tracker.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -35,7 +34,9 @@
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Application.GTCar.executor": "Run",
|
||||
"Application.GraphicsProgram.executor": "Run",
|
||||
"Application.Tracker.executor": "Run",
|
||||
"Downloaded.Files.Path.Enabled": "false",
|
||||
"Repository.Attach.Annotations": "false",
|
||||
"Repository.Attach.JavaDocs": "false",
|
||||
@ -45,7 +46,7 @@
|
||||
"com.codeium.enabled": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Users/david/Documents/Uni/GTCar/processing-4.3/core/library/core.jar",
|
||||
"last_opened_file_path": "C:/Users/david/Documents/Uni/GTCar/opencv/build/java/opencv-4100.jar",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
@ -57,6 +58,16 @@
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="GTCar" type="Application" factoryName="Application">
|
||||
<option name="MAIN_CLASS_NAME" value="Tracker" />
|
||||
<module name="GTCar_V2_maven" />
|
||||
<option name="VM_PARAMETERS" value="-Djava.library.path=C:\Users\david\Documents\Uni\GTCar\opencv\build\java\x64" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
@ -66,7 +77,7 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1732108904989</updated>
|
||||
<workItem from="1732108906083" duration="758000" />
|
||||
<workItem from="1732113837570" duration="8726000" />
|
||||
<workItem from="1732113837570" duration="11452000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="First Commit Test">
|
||||
<option name="closed" value="true" />
|
||||
@ -92,7 +103,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1732368525826</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="4" />
|
||||
<task id="LOCAL-00004" summary="Version 27.11">
|
||||
<option name="closed" value="true" />
|
||||
<created>1732703104268</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1732703104268</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="5" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -113,6 +132,7 @@
|
||||
<MESSAGE value="First Commit Test" />
|
||||
<MESSAGE value="Version 20.11" />
|
||||
<MESSAGE value="Version 23.11 (Grafics update)" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Version 23.11 (Grafics update)" />
|
||||
<MESSAGE value="Version 27.11" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Version 27.11" />
|
||||
</component>
|
||||
</project>
|
@ -18,6 +18,7 @@ public class Tracker {
|
||||
private final int EXP = -7; // Belichtungszeit (idealerweise: 0)
|
||||
private final int FPS = 60; // FPS
|
||||
|
||||
private Point currentPosition;
|
||||
public Tracker(){
|
||||
|
||||
}
|
||||
@ -34,16 +35,54 @@ public class Tracker {
|
||||
System.out.println("Fehler: Die Webcam konnte nicht geöffnet werden.");
|
||||
return;
|
||||
}
|
||||
|
||||
Mat frame = new Mat();
|
||||
|
||||
while (true){
|
||||
if (capture.read(frame)){
|
||||
HighGui.imshow("GTCar", frame);
|
||||
|
||||
currentPosition = trackPosition(frame);
|
||||
|
||||
if (HighGui.waitKey(1) == 27) {
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
System.out.println("Fehler: Das Kamerabild konnte nicht gelesen werden.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int getX(){
|
||||
return x;
|
||||
return (int) currentPosition.x;
|
||||
}
|
||||
|
||||
public int getY(){
|
||||
return y;
|
||||
return (int) currentPosition.y;
|
||||
}
|
||||
|
||||
public Point getPosition(){
|
||||
return currentPosition;
|
||||
}
|
||||
|
||||
|
||||
private Point trackPosition(Mat thresholdFrame) {
|
||||
// Berechne die Momente des binären Bildes
|
||||
Moments moments = Imgproc.moments(thresholdFrame);
|
||||
|
||||
// Prüfen, ob m00 (Fläche) nicht null ist, um Division durch Null zu vermeiden
|
||||
if (moments.get_m00() != 0) {
|
||||
int cx = (int) (moments.get_m10() / moments.get_m00());
|
||||
int cy = (int) (moments.get_m01() / moments.get_m00());
|
||||
return new Point(cx, cy);
|
||||
} else {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private VideoCapture setUp() {
|
||||
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
|
||||
VideoCapture capture = new VideoCapture(CAM);
|
||||
|
Loading…
x
Reference in New Issue
Block a user