mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
added show multiple switch in ui and back end
This commit is contained in:
@@ -72,6 +72,8 @@ public class CVPipeline2d extends CVPipeline<CVPipeline2dResult, CVPipeline2dSet
|
||||
draw2dContoursSettings.boxOutlineSize = 2;
|
||||
draw2dContoursSettings.showRotatedBox = true;
|
||||
draw2dContoursSettings.showMaximumBox = true;
|
||||
draw2dContoursSettings.showMultiple = settings.multiple;
|
||||
|
||||
draw2dContoursPipe = new Draw2dContoursPipe(draw2dContoursSettings, camProps);
|
||||
outputMatPipe = new OutputMatPipe(settings.isBinary);
|
||||
}
|
||||
@@ -106,7 +108,7 @@ public class CVPipeline2d extends CVPipeline<CVPipeline2dResult, CVPipeline2dSet
|
||||
sortContoursPipe.setConfig(settings.sortMode, camProps, 5);
|
||||
collect2dTargetsPipe.setConfig(settings.calibrationMode, settings.point,
|
||||
settings.dualTargetCalibrationM, settings.dualTargetCalibrationB, camProps);
|
||||
draw2dContoursPipe.setConfig(camProps);
|
||||
draw2dContoursPipe.setConfig(settings.multiple, camProps);
|
||||
outputMatPipe.setConfig(settings.isBinary);
|
||||
|
||||
long pipeInitTimeNanos = System.nanoTime() - pipelineStartTimeNanos;
|
||||
|
||||
@@ -20,6 +20,7 @@ public class CVPipeline2dSettings extends CVPipelineSettings {
|
||||
public Number speckle = 5;
|
||||
public boolean isBinary = false;
|
||||
public SortMode sortMode = SortMode.Largest;
|
||||
public boolean multiple = false;
|
||||
public TargetGroup targetGroup = TargetGroup.Single;
|
||||
public TargetIntersection targetIntersection = TargetIntersection.Up;
|
||||
public List<Number> point = Arrays.asList(0, 0);
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DriverVisionPipeline extends CVPipeline<DriverPipelineResult, CVPip
|
||||
if(draw2dContoursPipe == null) {
|
||||
draw2dContoursPipe = new Draw2dContoursPipe(draw2dContoursSettings, camProps);
|
||||
} else {
|
||||
draw2dContoursPipe.setConfig(camProps);
|
||||
draw2dContoursPipe.setConfig(false,camProps);
|
||||
}
|
||||
|
||||
draw2dContoursPipe.run(Pair.of(outputMat, blankList)).getLeft().copyTo(outputMat);
|
||||
|
||||
@@ -25,7 +25,8 @@ public class Draw2dContoursPipe implements Pipe<Pair<Mat, List<RotatedRect>>, Ma
|
||||
this.camProps = camProps;
|
||||
}
|
||||
|
||||
public void setConfig(CaptureStaticProperties captureProps) {
|
||||
public void setConfig(boolean showMultiple,CaptureStaticProperties captureProps) {
|
||||
settings.showMultiple = showMultiple;
|
||||
camProps = captureProps;
|
||||
}
|
||||
|
||||
@@ -37,7 +38,11 @@ public class Draw2dContoursPipe implements Pipe<Pair<Mat, List<RotatedRect>>, Ma
|
||||
input.getLeft().copyTo(processBuffer);
|
||||
|
||||
if (input.getRight().size() > 0) {
|
||||
for (RotatedRect r : input.getRight()) {
|
||||
for (int i = 0; i < input.getRight().size() - 1; i++) {
|
||||
if (i != 0 && !settings.showMultiple){
|
||||
break;
|
||||
}
|
||||
RotatedRect r = input.getRight().get(i);
|
||||
if (r == null) continue;
|
||||
|
||||
List<MatOfPoint> drawnContour = new ArrayList<>();
|
||||
@@ -79,10 +84,10 @@ public class Draw2dContoursPipe implements Pipe<Pair<Mat, List<RotatedRect>>, Ma
|
||||
long processTime = System.nanoTime() - processStartNanos;
|
||||
return Pair.of(outputMat, processTime);
|
||||
}
|
||||
|
||||
public static class Draw2dContoursSettings {
|
||||
public boolean showCentroid = false;
|
||||
public boolean showCrosshair = false;
|
||||
public boolean showMultiple = false;
|
||||
public int boxOutlineSize = 0;
|
||||
public boolean showRotatedBox = false;
|
||||
public boolean showMaximumBox = false;
|
||||
|
||||
@@ -33,6 +33,7 @@ export default new Vuex.Store({
|
||||
targetGrouping: 0,
|
||||
targetIntersection: 0,
|
||||
sortMode: 0,
|
||||
multiple:false,
|
||||
isBinary: 0,
|
||||
calibrationMode: 0
|
||||
},
|
||||
|
||||
@@ -269,7 +269,11 @@
|
||||
let p = this.$store.state.point.calculated;
|
||||
let fps = this.$store.state.point.fps;
|
||||
if (p !== undefined) {
|
||||
return `Pitch: ${parseFloat(p['pitch']).toFixed(2)}, Yaw: ${parseFloat(p['yaw']).toFixed(2)}, Area: ${p['area'].toFixed(2)}, FPS: ${fps.toFixed(2)}`
|
||||
try {
|
||||
return `Pitch: ${parseFloat(p['pitch']).toFixed(2)}, Yaw: ${parseFloat(p['yaw']).toFixed(2)}, Area: ${p['area'].toFixed(2)}, FPS: ${fps.toFixed(2)}`
|
||||
} catch (e) {
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<CVselect name="SortMode" v-model="value.sortMode"
|
||||
:list="['Largest','Smallest','Highest','Lowest','Rightmost','Leftmost','Centermost']"
|
||||
@input="handleData('sortMode')"/>
|
||||
<CVswitch name="Output multiple" v-model="value.multiple" @input="handleData('multiple')"></CVswitch>
|
||||
<span>Calibrate:</span>
|
||||
<v-divider dark color="white"/>
|
||||
<CVselect name="Calibration Mode" v-model="value.calibrationMode" :list="['None','Single point','Dual point']"
|
||||
@@ -17,14 +18,17 @@
|
||||
|
||||
<script>
|
||||
import CVselect from '../../components/cv-select'
|
||||
import CVswitch from '../../components/cv-switch'
|
||||
import DualCalibration from "../../components/OutputTab/DualCalibration";
|
||||
import SingleCalibration from "../../components/OutputTab/SingleCalibration";
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Output',
|
||||
props: ['value'],
|
||||
components: {
|
||||
CVselect,
|
||||
CVswitch,
|
||||
SingleCalibration,
|
||||
DualCalibration,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user