mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-26 01:51:40 +00:00
Merge branch 'dev' into 'master'
Dev See merge request chameleon-vision/Chameleon-Vision!16
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.chameleon-vision.main</groupId>
|
||||
<artifactId>chameleon-vision</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>1.0.2-BETA</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<!--setup for java jdk 12-->
|
||||
|
||||
@@ -56,16 +56,18 @@ public class CVProcess {
|
||||
List<MatOfPoint> FilterContours(List<MatOfPoint> InputContours, List<Integer> area, List<Double> ratio, List<Integer> extent) {
|
||||
for (MatOfPoint Contour : InputContours) {
|
||||
try {
|
||||
double contourArea = Imgproc.contourArea(Contour); //TODO change scaling
|
||||
double targetArea = (contourArea / CamVals.ImageArea) * 100;
|
||||
double minArea = Math.pow(area.get(0), 4);
|
||||
double maxArea = Math.pow(area.get(1), 4);
|
||||
if (targetArea < minArea || targetArea > maxArea) {
|
||||
double contourArea = Imgproc.contourArea(Contour);
|
||||
double minArea = (area.get(0) * CamVals.ImageArea) / 100;
|
||||
double maxArea = (area.get(1) * CamVals.ImageArea) / 100;
|
||||
if (contourArea <= minArea || contourArea >= maxArea) {
|
||||
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)) {
|
||||
|
||||
var targetFullness = contourArea;
|
||||
double minExtent = (double) (extent.get(0) * rect.size.area())/ 100;
|
||||
double maxExtent = (double) (extent.get(1) * rect.size.area()) / 100;
|
||||
if (targetFullness <= minExtent || contourArea >= maxExtent) {
|
||||
continue;
|
||||
}
|
||||
double aspectRatio = rect.size.width / rect.size.height;//TODO i think aspectRatio is inverted
|
||||
|
||||
@@ -146,6 +146,7 @@ public class VisionProcess implements Runnable {
|
||||
GroupedContours = cvProcess.GroupTargets(FilteredContours, currentPipeline.target_intersection, currentPipeline.target_group);
|
||||
if (GroupedContours.size() > 0) {
|
||||
var finalRect = cvProcess.SortTargetsToOne(GroupedContours, currentPipeline.sort_mode);
|
||||
// System.out.printf("Largest Contour Area: %.2f\n", finalRect.size.area());
|
||||
pipelineResult.RawPoint = finalRect;
|
||||
pipelineResult.IsValid = true;
|
||||
if (!currentPipeline.is_calibrated) {
|
||||
@@ -153,7 +154,7 @@ public class VisionProcess implements Runnable {
|
||||
pipelineResult.CalibratedY = camera.getCamVals().CenterY;
|
||||
} else {
|
||||
pipelineResult.CalibratedX = (finalRect.center.y - currentPipeline.B) / currentPipeline.M;
|
||||
pipelineResult.CalibratedY = finalRect.center.x * currentPipeline.M + currentPipeline.B;
|
||||
pipelineResult.CalibratedY = (finalRect.center.x * currentPipeline.M) + currentPipeline.B;
|
||||
}
|
||||
pipelineResult.Pitch = camera.getCamVals().CalculatePitch(finalRect.center.y, pipelineResult.CalibratedY);
|
||||
pipelineResult.Yaw = camera.getCamVals().CalculateYaw(finalRect.center.x, pipelineResult.CalibratedX);
|
||||
|
||||
Reference in New Issue
Block a user