mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-05 03:21:40 +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
|
Main/target
|
||||||
|
|
||||||
New client/chameleon-client/node_modules/
|
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>
|
<release>12</release>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -24,13 +24,17 @@ public class NetworkSettings {
|
|||||||
}
|
}
|
||||||
executeCommand("hostnamectl set-hostname " + this.hostname);
|
executeCommand("hostnamectl set-hostname " + this.hostname);
|
||||||
}
|
}
|
||||||
//TODO add windows networking commands
|
//TODO check windows commands
|
||||||
|
else if (SystemUtils.IS_OS_WINDOWS) {
|
||||||
// else
|
if (!adapter.equals("")) {
|
||||||
// if (SystemUtils.IS_OS_WINDOWS)
|
if (connectionType.equals("DHCP"))
|
||||||
// {
|
executeCommand("cmd /c interface ip set address \"" + adapter + "\" dhcp");
|
||||||
// executeCommand("cmd /c COMMAND HERE");
|
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) {
|
private void executeCommand(String command) {
|
||||||
@@ -51,7 +55,7 @@ public class NetworkSettings {
|
|||||||
Enumeration<InetAddress> ee = netint.getInetAddresses();
|
Enumeration<InetAddress> ee = netint.getInetAddresses();
|
||||||
for (InetAddress addr : Collections.list(ee))
|
for (InetAddress addr : Collections.list(ee))
|
||||||
if (addr instanceof Inet4Address)
|
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());
|
System.out.println("found robot network interface at " + netint.getName() + " ip: " + addr.getHostAddress());
|
||||||
return netint.getName();
|
return netint.getName();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,29 +53,33 @@ public class CVProcess {
|
|||||||
return FoundContours;
|
return FoundContours;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent) {
|
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Integer> ratio, List<Integer> extent) {
|
||||||
for (MatOfPoint Contour : InputContours) {
|
for (MatOfPoint Contour : InputContours){
|
||||||
try {
|
try{
|
||||||
var contourArea = Imgproc.contourArea(Contour);
|
var contourArea = Imgproc.contourArea(Contour);//TODO change scaling
|
||||||
double targetArea = FastMath.round((contourArea / CamVals.ImageArea) * 100);
|
int targetArea = (int) ((((float) contourArea) / CamVals.ImageArea) * 100);
|
||||||
if (targetArea <= area.get(0) || targetArea >= area.get(1)) {
|
if (targetArea < area.get(0) || targetArea > area.get(1)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
var rect = Imgproc.minAreaRect(new MatOfPoint2f(Contour.toArray()));
|
||||||
var targetFullness = (contourArea / rect.size.area()) * 100;
|
var targetFullness = (contourArea / rect.size.area()) * 100;
|
||||||
if (targetFullness <= extent.get(0) || targetArea >= extent.get(1)) {
|
if (targetFullness < extent.get(0) || targetArea > extent.get(1)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var aspectRatio = rect.size.width / rect.size.height;
|
double aspectRatio = rect.size.width / rect.size.height;//TODO i think aspectRatio is inverted
|
||||||
if (aspectRatio <= ratio.get(0) || aspectRatio >= ratio.get(1)) {
|
if (aspectRatio < ratio.get(0) || aspectRatio > ratio.get(1)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FilteredContours.add(Contour);
|
FilteredContours.add(Contour);
|
||||||
} catch (Exception ignored) {
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
return FilteredContours;
|
System.err.println("Error while filtering contours");
|
||||||
}
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FilteredContours;
|
||||||
|
}
|
||||||
|
|
||||||
private double calcDistance(RotatedRect rect) {
|
private double calcDistance(RotatedRect rect) {
|
||||||
return FastMath.sqrt(FastMath.pow(CamVals.CenterX - rect.center.x, 2) + FastMath.pow(CamVals.CenterY - rect.center.y, 2));
|
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>
|
<chselect title="camera" :list="cameraList" Xkey="curr_camera"></chselect>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span="12">
|
<Col span="12">
|
||||||
<chselect title="pipline" :list="pipelineList" Xkey="curr_pipeline"></chselect>
|
<chselect title="pipeline" :list="pipelineList" Xkey="curr_pipeline"></chselect>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Header>
|
</Header>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<chrange class="spacing" title="Extent" Xkey="extent"></chrange>
|
<chrange class="spacing" title="Extent" Xkey="extent"></chrange>
|
||||||
<chselect class="spacing" title="Target Group" Xkey="target_group"
|
<chselect class="spacing" title="Target Group" Xkey="target_group"
|
||||||
:list="['Single','Dual','Triple','Quadruple','Quintuple']"></chselect>
|
: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>
|
:list="['Up','Down','Left','Right','Parallel']" :isDisabled="isSingle"></chselect>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user