mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Merge remote-tracking branch 'origin/Java' into Java
# Conflicts: # Main/src/main/java/com/chameleonvision/vision/process/CVProcess.java
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -109,3 +109,5 @@ Main/.gradle
|
||||
Main/target
|
||||
|
||||
New client/chameleon-client/node_modules/
|
||||
Main/dependency-reduced-pom.xml
|
||||
Main/src/main/java/META-INF
|
||||
|
||||
13
Main/pom.xml
13
Main/pom.xml
@@ -17,6 +17,19 @@
|
||||
<release>12</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
|
||||
@@ -24,13 +24,17 @@ public class NetworkSettings {
|
||||
}
|
||||
executeCommand("hostnamectl set-hostname " + this.hostname);
|
||||
}
|
||||
//TODO add windows networking commands
|
||||
|
||||
// else
|
||||
// if (SystemUtils.IS_OS_WINDOWS)
|
||||
// {
|
||||
// executeCommand("cmd /c COMMAND HERE");
|
||||
// }
|
||||
//TODO check windows commands
|
||||
else if (SystemUtils.IS_OS_WINDOWS) {
|
||||
if (!adapter.equals("")) {
|
||||
if (connectionType.equals("DHCP"))
|
||||
executeCommand("cmd /c interface ip set address \"" + adapter + "\" dhcp");
|
||||
else if (connectionType.equals("Static")) {
|
||||
executeCommand("cmd /c netsh interface ip set address \"" + adapter + "\" static " + this.ip + " " + this.netmask + " " + this.gateway + "1");
|
||||
}
|
||||
}
|
||||
//TODO find a way to change hostname in windows
|
||||
}
|
||||
}
|
||||
|
||||
private void executeCommand(String command) {
|
||||
@@ -51,7 +55,7 @@ public class NetworkSettings {
|
||||
Enumeration<InetAddress> ee = netint.getInetAddresses();
|
||||
for (InetAddress addr : Collections.list(ee))
|
||||
if (addr instanceof Inet4Address)
|
||||
if ((addr.getAddress()[0] & 0xFF) == 10 && (addr.getAddress()[1] & 0xFF) == SettingsManager.GeneralSettings.team_number) {
|
||||
if ((addr.getAddress()[0] & 0xFF) == 10 && (addr.getAddress()[1] & 0xFF) == SettingsManager.GeneralSettings.team_number) {
|
||||
System.out.println("found robot network interface at " + netint.getName() + " ip: " + addr.getHostAddress());
|
||||
return netint.getName();
|
||||
}
|
||||
|
||||
@@ -53,29 +53,33 @@ public class CVProcess {
|
||||
return FoundContours;
|
||||
}
|
||||
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent) {
|
||||
for (MatOfPoint Contour : InputContours) {
|
||||
try {
|
||||
var contourArea = Imgproc.contourArea(Contour);
|
||||
double targetArea = FastMath.round((contourArea / CamVals.ImageArea) * 100);
|
||||
if (targetArea <= area.get(0) || targetArea >= area.get(1)) {
|
||||
continue;
|
||||
}
|
||||
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
||||
var targetFullness = (contourArea / rect.size.area()) * 100;
|
||||
if (targetFullness <= extent.get(0) || targetArea >= extent.get(1)) {
|
||||
continue;
|
||||
}
|
||||
var aspectRatio = rect.size.width / rect.size.height;
|
||||
if (aspectRatio <= ratio.get(0) || aspectRatio >= ratio.get(1)) {
|
||||
continue;
|
||||
}
|
||||
FilteredContours.add(Contour);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
return FilteredContours;
|
||||
}
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent) {
|
||||
for (MatOfPoint Contour : InputContours){
|
||||
try{
|
||||
var contourArea = Imgproc.contourArea(Contour);//TODO change scaling
|
||||
int targetArea = (int) ((((float) contourArea) / CamVals.ImageArea) * 100);
|
||||
if (targetArea < area.get(0) || targetArea > area.get(1)){
|
||||
continue;
|
||||
}
|
||||
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
||||
var targetFullness = (contourArea / rect.size.area()) * 100;
|
||||
if (targetFullness < extent.get(0) || targetArea > extent.get(1)){
|
||||
continue;
|
||||
}
|
||||
double aspectRatio = rect.size.width / rect.size.height;//TODO i think aspectRatio is inverted
|
||||
if (aspectRatio < ratio.get(0) || aspectRatio > ratio.get(1)){
|
||||
continue;
|
||||
}
|
||||
FilteredContours.add(Contour);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Error while filtering contours");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return FilteredContours;
|
||||
}
|
||||
|
||||
private double calcDistance(RotatedRect rect) {
|
||||
return FastMath.sqrt(FastMath.pow(CamVals.CenterX - rect.center.x, 2) + FastMath.pow(CamVals.CenterY - rect.center.y, 2));
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<chselect title="camera" :list="cameraList" Xkey="curr_camera"></chselect>
|
||||
</Col>
|
||||
<Col span="12">
|
||||
<chselect title="pipline" :list="pipelineList" Xkey="curr_pipeline"></chselect>
|
||||
<chselect title="pipeline" :list="pipelineList" Xkey="curr_pipeline"></chselect>
|
||||
</Col>
|
||||
</Row>
|
||||
</Header>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<chrange class="spacing" title="Extent" Xkey="extent"></chrange>
|
||||
<chselect class="spacing" title="Target Group" Xkey="target_group"
|
||||
:list="['Single','Dual','Triple','Quadruple','Quintuple']"></chselect>
|
||||
<chselect class="spacing" title="Target Intersaction" Xkey="target_intersection"
|
||||
<chselect class="spacing" title="Target Intersection" Xkey="target_intersection"
|
||||
:list="['Up','Down','Left','Right','Parallel']" :isDisabled="isSingle"></chselect>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user