2019-09-22 00:14:12 +03:00
|
|
|
<template>
|
2022-02-21 22:41:51 -05:00
|
|
|
<div :style="{'--averageHue': averageHue}">
|
2020-07-13 19:34:31 -07:00
|
|
|
<CVrangeSlider
|
2022-02-21 22:41:51 -05:00
|
|
|
id="hue-slider"
|
2022-01-16 08:25:37 -08:00
|
|
|
v-model="hsvHue"
|
2022-02-21 22:41:51 -05:00
|
|
|
:class="hueInverted ? 'inverted-slider' : 'normal-slider'"
|
2022-01-16 08:25:37 -08:00
|
|
|
name="Hue"
|
|
|
|
|
tooltip="Describes color"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="180"
|
2022-02-21 22:41:51 -05:00
|
|
|
:inverted="hueInverted"
|
2022-01-16 08:25:37 -08:00
|
|
|
@input="handlePipelineData('hsvHue')"
|
|
|
|
|
@rollback="e => rollback('hue',e)"
|
2020-07-13 19:34:31 -07:00
|
|
|
/>
|
|
|
|
|
<CVrangeSlider
|
2022-02-21 22:41:51 -05:00
|
|
|
id="sat-slider"
|
2022-01-16 08:25:37 -08:00
|
|
|
v-model="hsvSaturation"
|
2022-02-21 22:41:51 -05:00
|
|
|
class="normal-slider"
|
2022-01-16 08:25:37 -08:00
|
|
|
name="Saturation"
|
|
|
|
|
tooltip="Describes colorfulness; the smaller this value the 'whiter' the color becomes"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="255"
|
|
|
|
|
@input="handlePipelineData('hsvSaturation')"
|
|
|
|
|
@rollback="e => rollback('saturation',e)"
|
2020-07-13 19:34:31 -07:00
|
|
|
/>
|
|
|
|
|
<CVrangeSlider
|
2022-02-21 22:41:51 -05:00
|
|
|
id="value-slider"
|
2022-01-16 08:25:37 -08:00
|
|
|
v-model="hsvValue"
|
2022-02-21 22:41:51 -05:00
|
|
|
class="normal-slider"
|
2022-01-16 08:25:37 -08:00
|
|
|
name="Value"
|
|
|
|
|
tooltip="Describes lightness; the smaller this value the 'blacker' the color becomes"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="255"
|
|
|
|
|
@input="handlePipelineData('hsvValue')"
|
|
|
|
|
@rollback="e => rollback('value',e)"
|
2020-07-13 19:34:31 -07:00
|
|
|
/>
|
2022-02-21 22:41:51 -05:00
|
|
|
<CVSwitch
|
|
|
|
|
v-model="hueInverted"
|
|
|
|
|
name="Invert hue"
|
|
|
|
|
tooltip="Selects the hue range outside of the hue slider bounds instead of inside"
|
|
|
|
|
@input="handlePipelineData('hueInverted')"
|
|
|
|
|
@rollback="e => rollback('hueInverted',e)"
|
|
|
|
|
/>
|
2020-07-31 13:50:50 -07:00
|
|
|
<div class="pt-3 white--text">
|
|
|
|
|
Color Picker
|
|
|
|
|
</div>
|
2020-07-13 19:34:31 -07:00
|
|
|
<v-divider
|
2022-01-16 08:25:37 -08:00
|
|
|
class="mt-3"
|
2020-07-13 19:34:31 -07:00
|
|
|
/>
|
2020-07-31 13:50:50 -07:00
|
|
|
<v-row
|
2022-01-16 08:25:37 -08:00
|
|
|
justify="center"
|
|
|
|
|
class="mt-3 mb-3"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<template v-if="!$store.state.colorPicking">
|
|
|
|
|
<v-btn
|
2022-01-16 08:25:37 -08:00
|
|
|
color="accent"
|
|
|
|
|
class="ma-2 black--text"
|
|
|
|
|
small
|
2022-02-27 00:09:44 -05:00
|
|
|
@click="setFunction(hueInverted ? 2 : 3)"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-minus
|
|
|
|
|
</v-icon>
|
|
|
|
|
Shrink Range
|
|
|
|
|
</v-btn>
|
|
|
|
|
<v-btn
|
2022-01-16 08:25:37 -08:00
|
|
|
color="accent"
|
|
|
|
|
class="ma-2 black--text"
|
|
|
|
|
small
|
|
|
|
|
@click="setFunction(1)"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-plus-minus
|
|
|
|
|
</v-icon>
|
2022-02-27 00:09:44 -05:00
|
|
|
{{ hueInverted ? "Exclude" : "Set to" }} Average
|
2020-07-31 13:50:50 -07:00
|
|
|
</v-btn>
|
|
|
|
|
<v-btn
|
2022-01-16 08:25:37 -08:00
|
|
|
color="accent"
|
|
|
|
|
class="ma-2 black--text"
|
|
|
|
|
small
|
2022-02-27 00:09:44 -05:00
|
|
|
@click="setFunction(hueInverted ? 3: 2)"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
<v-icon left>
|
|
|
|
|
mdi-plus
|
|
|
|
|
</v-icon>
|
|
|
|
|
Expand Range
|
|
|
|
|
</v-btn>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<v-btn
|
2022-01-16 08:25:37 -08:00
|
|
|
color="accent"
|
|
|
|
|
class="ma-2 black--text"
|
|
|
|
|
style="width: 30%;"
|
|
|
|
|
small
|
|
|
|
|
@click="setFunction(0)"
|
2020-07-31 13:50:50 -07:00
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</v-btn>
|
|
|
|
|
</template>
|
2020-07-13 19:34:31 -07:00
|
|
|
</v-row>
|
2022-01-16 08:25:37 -08:00
|
|
|
<v-divider class="mb-3" />
|
2020-07-13 19:34:31 -07:00
|
|
|
</div>
|
2019-09-22 00:14:12 +03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-09-03 19:20:55 -07:00
|
|
|
import CVrangeSlider from '../../components/common/cv-range-slider'
|
|
|
|
|
import CVSwitch from "@/components/common/cv-switch";
|
2020-07-31 13:50:50 -07:00
|
|
|
|
2021-09-03 19:20:55 -07:00
|
|
|
export default {
|
|
|
|
|
name: 'Threshold',
|
|
|
|
|
components: {
|
|
|
|
|
CVSwitch,
|
|
|
|
|
CVrangeSlider
|
|
|
|
|
},
|
|
|
|
|
// eslint-disable-next-line vue/require-prop-types
|
|
|
|
|
props: ['value'],
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
currentFunction: undefined,
|
|
|
|
|
colorPicker: undefined,
|
|
|
|
|
showThresholdState: 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
hsvHue: {
|
|
|
|
|
get() {
|
|
|
|
|
return this.$store.getters.currentPipelineSettings.hsvHue
|
|
|
|
|
},
|
|
|
|
|
set(val) {
|
|
|
|
|
this.$store.commit("mutatePipeline", {"hsvHue": val})
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-02-21 22:41:51 -05:00
|
|
|
averageHue: {
|
|
|
|
|
get() {
|
2023-06-09 13:09:41 -04:00
|
|
|
const isInverted = this.$store.getters.currentPipelineSettings.hueInverted;
|
2022-02-21 22:41:51 -05:00
|
|
|
const arr = this.$store.getters.currentPipelineSettings.hsvHue;
|
2023-06-09 13:09:41 -04:00
|
|
|
let retVal = 0;
|
2022-02-27 00:09:44 -05:00
|
|
|
|
2022-02-21 22:41:51 -05:00
|
|
|
if (Array.isArray(arr)) {
|
2022-02-27 00:09:44 -05:00
|
|
|
retVal = (arr[0] + arr[1]);
|
|
|
|
|
} else {
|
|
|
|
|
retVal = (arr.first + arr.second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(isInverted){
|
|
|
|
|
retVal += 180;
|
2022-02-21 22:41:51 -05:00
|
|
|
}
|
2022-02-27 00:09:44 -05:00
|
|
|
|
|
|
|
|
if(retVal > 360){
|
|
|
|
|
retVal -= 360;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
|
|
2022-02-21 22:41:51 -05:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
hueInverted: {
|
|
|
|
|
get() {
|
|
|
|
|
return this.$store.getters.currentPipelineSettings.hueInverted;
|
|
|
|
|
},
|
|
|
|
|
set(val) {
|
|
|
|
|
this.$store.commit("mutatePipeline", {"hueInverted": val});
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-09-03 19:20:55 -07:00
|
|
|
hsvSaturation: {
|
|
|
|
|
get() {
|
2022-02-21 22:41:51 -05:00
|
|
|
return this.$store.getters.currentPipelineSettings.hsvSaturation;
|
2021-09-03 19:20:55 -07:00
|
|
|
},
|
|
|
|
|
set(val) {
|
|
|
|
|
this.$store.commit("mutatePipeline", {"hsvSaturation": val})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
hsvValue: {
|
|
|
|
|
get() {
|
2022-02-21 22:41:51 -05:00
|
|
|
return this.$store.getters.currentPipelineSettings.hsvValue;
|
2021-09-03 19:20:55 -07:00
|
|
|
},
|
|
|
|
|
set(val) {
|
2022-02-21 22:41:51 -05:00
|
|
|
this.$store.commit("mutatePipeline", {"hsvValue": val});
|
2021-09-03 19:20:55 -07:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted: function () {
|
|
|
|
|
const self = this;
|
|
|
|
|
this.colorPicker = require('../../plugins/ColorPicker').default;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
self.colorPicker.initColorPicker();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onClick(event) {
|
|
|
|
|
if (this.currentFunction !== undefined) {
|
|
|
|
|
this.colorPicker.initColorPicker();
|
|
|
|
|
|
|
|
|
|
let s = this.$store.getters.currentPipelineSettings;
|
|
|
|
|
let hsvArray = this.colorPicker.colorPickerClick(event, this.currentFunction,
|
|
|
|
|
[
|
|
|
|
|
[s.hsvHue[0], s.hsvSaturation[0], s.hsvValue[0]],
|
|
|
|
|
[s.hsvHue[1], s.hsvSaturation[1], s.hsvValue[1]]
|
|
|
|
|
].map(hsv => hsv.map(it => it || 0)));
|
|
|
|
|
// That `map` calls are to make sure that we don't let any undefined/null values slip in
|
|
|
|
|
this.currentFunction = undefined;
|
|
|
|
|
this.$store.state.colorPicking = false;
|
|
|
|
|
this.handlePipelineUpdate("outputShouldDraw", true);
|
2020-07-31 13:50:50 -07:00
|
|
|
|
2021-09-03 19:20:55 -07:00
|
|
|
s.hsvHue = [hsvArray[0][0], hsvArray[1][0]];
|
|
|
|
|
s.hsvSaturation = [hsvArray[0][1], hsvArray[1][1]];
|
|
|
|
|
s.hsvValue = [hsvArray[0][2], hsvArray[1][2]];
|
2020-07-31 13:50:50 -07:00
|
|
|
|
2021-09-03 19:20:55 -07:00
|
|
|
let msg = this.$msgPack.encode({
|
|
|
|
|
"changePipelineSetting": {
|
|
|
|
|
'hsvHue': s.hsvHue,
|
|
|
|
|
'hsvSaturation': s.hsvSaturation,
|
|
|
|
|
'hsvValue': s.hsvValue,
|
|
|
|
|
'cameraIndex': this.$store.state.currentCameraIndex
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-01-06 17:25:11 -08:00
|
|
|
this.$store.state.websocket.ws.send(msg);
|
2021-09-03 19:20:55 -07:00
|
|
|
this.$emit('update');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
setFunction(index) {
|
|
|
|
|
switch (index) {
|
|
|
|
|
case 0:
|
|
|
|
|
this.currentFunction = undefined;
|
|
|
|
|
this.$store.state.colorPicking = false;
|
2020-12-08 02:34:21 -05:00
|
|
|
|
2021-09-03 19:20:55 -07:00
|
|
|
this.handlePipelineUpdate("outputShouldDraw", true);
|
|
|
|
|
return;
|
|
|
|
|
case 1:
|
|
|
|
|
this.currentFunction = this.colorPicker.eyeDrop;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
this.currentFunction = this.colorPicker.expand;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
this.currentFunction = this.colorPicker.shrink;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
this.$store.state.colorPicking = true;
|
2020-12-08 02:34:21 -05:00
|
|
|
|
2021-09-03 19:20:55 -07:00
|
|
|
this.handlePipelineUpdate("outputShouldDraw", false);
|
|
|
|
|
this.$store.commit("mutatePipeline", {"inputShouldShow": true});
|
|
|
|
|
this.handlePipelineUpdate("inputShouldShow", true);
|
2019-09-22 00:14:12 +03:00
|
|
|
}
|
2021-09-03 19:20:55 -07:00
|
|
|
}
|
|
|
|
|
}
|
V2.1 (#37)
* Toggle mode
* RangeSlider able to be disabled
* Added another window from the press of the button
* removed warning
* Major changes to colorpicker page
* Major changes to threshold tab
* fix for BGR not RGB
* Reverted changes of colorpicker.vue
* Updated Readme.md
Mainly Development Setup
* Update readme
small changes
* updated readme.md
Authors credit update
* updated readme.md
added usb camera to hardware
* Updated UI readme
added nodejs installation and explanation
* Unit test vision (and implement networktable sending)
* finished color picker in the ui
* bugfix for correct tab
* cleanup and commenting
* Reveted changes to range slider
* bug fix for color picker
* Pipeline mat copy fix
* Added crosshair pipe
* compilation fix
* removed unsued comment
* moved calibration stuff to static class under 2d pipeline settings
* Added debug print commented
* Reverted subclass "Calibration"
Fixed bug where single point calibration causes crash when no target is found
* disable dual point crosshair for now
* Proper no target found fix, and snackbar error now showing
* Removed java fix for crash bug
* fixed problem with clear points in single point calibration
* change compatator to sqared values to make caluclation faster (no need for sqare root function)
* fixed roated camera too heigh for the UI
* Revert "fixed roated camera too heigh for the UI"
This reverts commit 50c8ecd34560ac0171b8d7497bec2e2d1d93d43f.
* fixed rotated camera too heigh for UI and corrected scalling
* updated pom to fix the camera buffer issue
* added pom variables
* Created new CaptureStaticProperties when rotating cam
* File stucture change, moved Pipeline implementation and their settings to /impl folder, refracted imports
* ignore auto created iml file
* ignore auto created iml file
* Fix lack of access problems after moving pipleline impl out of the same package
* Removed commented lines
* Fixed bug when selecting the same 90 deg rotation twice causes crosshair to move
* cleaned up single point calibration and bug fixed isBinary in driverMode
* Enum fix for the UI
* typo
* fixed Stream divisor problems see issue 19 in github issues
* fixed compilation error for test class
* Fixed problem when rotating camera with stream divisor
* Spelling + button style change
* Add speed limit to UI Updates
* Added runtime arg to fix settings permissions, and on-first-init
* Added FileHelper class to manage setting permissions for all files.
* Removed unnecessary argument
* NT can set pipeline to out on bound indexes
* bugfix in platform check
* added pipeline popup
* Round steam divisor resolution
* added regex test for camera name and pipe name
* Fix for Renaming pipeline leaves old config file #14
* Version change
* adde ( ) - and . to regex
* Replace NT timestamp with latency
* added back NT flush
* Add solvePNP, 3d tab on the UI, and some other misc bug fixes (#35)
* Rebase solvePNP on master
* added 3D tab minimap and csv reader
* More solvePNP
* Create draw pipe for pnp data
* SolvePNP piping work
* Move sorting into solvepnppipe
* Create calibration pipeline
* Update CalibrateSolvePNPPipeline.java
* add camera tilt angle
* Add calibration slider and snapshot button to 3D view
* Mirror updates in the socket handler
* add 3d calibration mode to the pipeline manager
* created calibration functions in ui and backend
* Start plumbing calibration
* Add snapshot and other handling to the RequestHandler
* added select resolution before starting calibration
* Rename solvePNPPipe to bounding box solve pnp pipe
* Update BoundingBoxSolvePNPPipe.java
* Add Mat serializer and CameraCalibrationConfig
* Begun calibration saving, fixed UI/Backend snapshot count mismatch
* Add (unplumbed) option to set checkerboard size
This will allow users to change the units their calibration is in
* Create chessboard.png
* Fix calibration NPE
* changed string serialization to a json send
* bug fixed cancellation button
* Fix spelling of snapshot in 3d.vue
* Plumb resolution change
* Set resolution during config, start on config serialization
* Update .gitignore
* Config fixes
* Start transition away from cvpipeline3d
* fix NPE on uncalibrated cameras
* clear list on fail
* Fix video mode index error
* ignore getters in camera calibration config
* Create json constructor for jsonmat
* get solvePNP mostly returning sane values
* Fix solvePNP bug and add unit test
* FIx calibration mat truncation
* added capture amount model upload and minimap data
* Standardize on meters in calibration and bounding box
* fix json out of bounds and handle null calibration more gracefully
* don't put text on calibrate image, go back to inches
* convert distance to meters
this means calibration will need to be in inches
* Actually save raw contor
* Update GroupContoursPipe.java
* Add all calibration return to camera capture
* hard code 2019 target
* bugfixed draw2d added fail calib popup, merge end and cancel
added the res index to the calib start
* Clarify error message and draw more fancy rectangles
* Cleanup memory in solvepnp
* re did minimap component
* fix npe if left/right is null
* remove references to 2d
* try-catch running the current pipeline
* Add method to find corners using the harris corner detector
* Possibly fix left/right missmatch
* Fix 3D Tab error
* FIx file permissions, mat serializer adjustments
* fixed mini map for field coordinates
* mini map changes fov
* Update SolvePNPPipe.java
* get rid of target corners
* some memory leak fixes
* fixed mini map location
* added position under minimap
* changed player fov look
* put all targets in the web send
* re did target send to ui added target tables, bugfix calibration
* fixed y position
* Add tilt angle to capture properties
* maybe fix y axis in minimap
* Add square size to onCalibrationEnding
* Possibly add square size to UI
* fix NPE with pitch
* Fix bug with sending multiple targets
* Only instantiate 3d stuff if we are in 3d mode
* Fix array list exceptions
* Fix bug in sort contors
list was truncated too early
* added download chess, tilt setting and ordinal tilt,
* added square size connection
* removed unused code
* Update pom version to 2.1-RELEASE
* Send camera calibrations to UI
* Stream pose list to a LIst
* Only stream necessary parts of the aux list entry
* Make broadcastMessage synchronized to prevent ConcurrentModificationExceptions
* added fps counter changed squaresize steps bug fixes in tables
* bugfix camera settings cam wont change
Authored-by: oriagranat9 <oriagranat9@gmail.com>
* disable pose print
* standardize on calibration in inches and add square size as a divisor
This should do the same thing as calibrating in the correct units but it doesnt like meeeeee
* updated pom for release, 3d calibration change, cosmetic changes
* WIP: 3D res filter
* bug fix in index parsing
* add good features to track point finder
* offset found corners by old tl position
* Add method to find most extreme per-quadrant points for solvePNP
* re did pipeline duplication
* Add release method to standard cv pipeline
* remove contor from tracked target
* Explicitly release all the intermediate results
* avoid creating new mats in group contors pipe
* removed mat release
* updated pom
* Actually cache the last target
We were trying to but i never hooked this part up
* Fix memory leak in sort contros pipe
* Fix memory leak in sort contors pipe
* Help more with memory usage in speckle reject and draw pipes
* minor bugfixes to the ui
* Start moving stream into vision process
Should probs move into a pipe to be idimatic
* justify bug fix
* Fix sort left/right bug
* Fix target grouping bug
* Avoid allocating a new mat in solvePNP, perf. increases in group contors pipe
* Event scripts (#36)
* Begin scripting work
* More scripting work
* Finalize scripting system
* Begin implementing script events
* Finalize script system
Co-authored-by: Banks T <btrout.dhrs@gmail.com>
Co-authored-by: OmerZ7 <zipory.omer@gmail.com>
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-01-04 11:53:18 -08:00
|
|
|
|
2021-11-21 17:22:56 -08:00
|
|
|
</script>
|
2022-02-21 22:41:51 -05:00
|
|
|
|
|
|
|
|
<style lang="css" scoped>
|
|
|
|
|
#hue-slider >>> .v-slider {
|
|
|
|
|
background: linear-gradient( to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100% );
|
|
|
|
|
border-radius: 10px;
|
2023-06-09 13:09:41 -04:00
|
|
|
box-shadow: 0 0 5px #333, inset 0 0 3px #333;
|
2022-02-21 22:41:51 -05:00
|
|
|
}
|
|
|
|
|
#sat-slider >>> .v-slider {
|
|
|
|
|
background: linear-gradient( to right, #fff 0%, hsl(var(--averageHue), 100%, 50%) 100% );
|
|
|
|
|
border-radius: 10px;
|
2023-06-09 13:09:41 -04:00
|
|
|
box-shadow: 0 0 5px #333, inset 0 0 3px #333;
|
2022-02-21 22:41:51 -05:00
|
|
|
}
|
|
|
|
|
#value-slider >>> .v-slider {
|
|
|
|
|
background: linear-gradient( to right, #000 0%, hsl(var(--averageHue), 100%, 50%) 100% );
|
|
|
|
|
border-radius: 10px;
|
2023-06-09 13:09:41 -04:00
|
|
|
box-shadow: 0 0 5px #333, inset 0 0 3px #333;
|
2022-02-21 22:41:51 -05:00
|
|
|
}
|
|
|
|
|
>>> .v-slider__thumb {
|
|
|
|
|
outline: black solid thin;
|
|
|
|
|
}
|
|
|
|
|
.normal-slider >>> .v-slider__track-fill {
|
|
|
|
|
outline: black solid thin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.inverted-slider >>> .v-slider__track-background {
|
|
|
|
|
outline: black solid thin;
|
|
|
|
|
}
|
|
|
|
|
</style>
|