From 5144819ce2dac1fd531c6a44d6c30064f36a2b89 Mon Sep 17 00:00:00 2001 From: Banks T Date: Mon, 21 Feb 2022 22:41:51 -0500 Subject: [PATCH] Invertable hue (#428) * Add UI-side changes for invertable hue slider * Add hue inverted range * Add new slider backgrounds to threshold tab * Run spotless * Updated libpicam.so to artifact built from commit c458bab87740 in that repo on gerth2's pi. * undo the java-side hack since isVCSMSupported is fixed * Hook up hue inversion frontend to backend and UI tweaks * Remove unused .flipped class * Fix hueInverted name in Vue.js store Co-authored-by: Declan Freeman-Gleason Co-authored-by: Matt Co-authored-by: Chris Gerth --- .../src/components/common/cv-radio.vue | 4 +- .../src/components/common/cv-range-slider.vue | 6 +- photon-client/src/plugins/ColorPicker.js | 6 +- photon-client/src/store/index.js | 1 + .../src/views/PipelineViews/ThresholdTab.vue | 71 ++++++++++++++++-- .../java/org/photonvision/raspi/PicamJNI.java | 4 +- .../vision/pipe/impl/HSVPipe.java | 49 +++++++++++- .../pipeline/AdvancedPipelineSettings.java | 3 + .../vision/pipeline/ColoredShapePipeline.java | 8 +- .../vision/pipeline/ReflectivePipeline.java | 4 +- .../resources/nativelibraries/libpicam.so | Bin 3338848 -> 3343580 bytes 11 files changed, 133 insertions(+), 23 deletions(-) diff --git a/photon-client/src/components/common/cv-radio.vue b/photon-client/src/components/common/cv-radio.vue index f0a6a0bad..0fdfcb2ff 100644 --- a/photon-client/src/components/common/cv-radio.vue +++ b/photon-client/src/components/common/cv-radio.vue @@ -18,10 +18,10 @@ :mandatory="true" > diff --git a/photon-client/src/components/common/cv-range-slider.vue b/photon-client/src/components/common/cv-range-slider.vue index 235c231bf..fa4227d2e 100644 --- a/photon-client/src/components/common/cv-range-slider.vue +++ b/photon-client/src/components/common/cv-range-slider.vue @@ -19,7 +19,9 @@ hide-details class="align-center" dark - color="accent" + :color="inverted ? 'rgba(255, 255, 255, 0.2)' : 'accent'" + :track-color="inverted ? 'accent' : undefined" + thumb-color="accent" :step="step" @input="handleInput" @mousedown="$emit('rollback', localValue)" @@ -76,7 +78,7 @@ export default { TooltippedLabel, }, // eslint-disable-next-line vue/require-prop-types - props: ["name", "min", "max", "value", "step", "tooltip", "disabled"], + props: ["name", "min", "max", "value", "step", "tooltip", "disabled", "inverted"], data() { return { prependFocused: false, diff --git a/photon-client/src/plugins/ColorPicker.js b/photon-client/src/plugins/ColorPicker.js index 1c0bd0c74..b887fd2da 100644 --- a/photon-client/src/plugins/ColorPicker.js +++ b/photon-client/src/plugins/ColorPicker.js @@ -6,8 +6,10 @@ function initColorPicker() { canvas = document.createElement('canvas'); image = document.querySelector('#normal-stream'); - canvas.width = image.width; - canvas.height = image.height; + if (image !== null) { + canvas.width = image.width; + canvas.height = image.height; + } } //Called on click of the image, diff --git a/photon-client/src/store/index.js b/photon-client/src/store/index.js index c5989533f..714534c57 100644 --- a/photon-client/src/store/index.js +++ b/photon-client/src/store/index.js @@ -64,6 +64,7 @@ export default new Vuex.Store({ hsvHue: [0, 15], hsvSaturation: [0, 15], hsvValue: [0, 25], + hueInverted: false, contourArea: [0, 12], contourRatio: [0, 12], contourFullness: [0, 12], diff --git a/photon-client/src/views/PipelineViews/ThresholdTab.vue b/photon-client/src/views/PipelineViews/ThresholdTab.vue index ee488c8ec..62976f25a 100644 --- a/photon-client/src/views/PipelineViews/ThresholdTab.vue +++ b/photon-client/src/views/PipelineViews/ThresholdTab.vue @@ -1,16 +1,21 @@