Image fraction and label as a thing property in webapp
This commit is contained in:
parent
9eb0b6a6b8
commit
cb916bb4a3
1 changed files with 29 additions and 2 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
submit-label="Set background"
|
submit-label="Set background"
|
||||||
:can-terminate="false"
|
:can-terminate="false"
|
||||||
:poll-interval="0.1"
|
:poll-interval="0.1"
|
||||||
|
@response="alertBackgroundSet"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
|
|
@ -19,6 +20,13 @@
|
||||||
label="Tolerance"
|
label="Tolerance"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<propertyControl
|
||||||
|
thing-name="background_detect"
|
||||||
|
property-name="fraction"
|
||||||
|
label="Sample coverage required"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="uk-margin">
|
<div class="uk-margin">
|
||||||
<taskSubmitter
|
<taskSubmitter
|
||||||
:submit-url="backgroundFractionUri"
|
:submit-url="backgroundFractionUri"
|
||||||
|
|
@ -28,6 +36,15 @@
|
||||||
@response="alertBackgroundFraction"
|
@response="alertBackgroundFraction"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="uk-margin">
|
||||||
|
<taskSubmitter
|
||||||
|
:submit-url="labelImageUri"
|
||||||
|
submit-label="Label current image"
|
||||||
|
:can-terminate="false"
|
||||||
|
:poll-interval="0.1"
|
||||||
|
@response="alertImageLabel"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -43,6 +60,9 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
labelImageUri() {
|
||||||
|
return this.thingActionUrl("background_detect", "image_is_sample");
|
||||||
|
},
|
||||||
backgroundFractionUri() {
|
backgroundFractionUri() {
|
||||||
return this.thingActionUrl("background_detect", "background_fraction");
|
return this.thingActionUrl("background_detect", "background_fraction");
|
||||||
},
|
},
|
||||||
|
|
@ -59,8 +79,15 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
alertBackgroundFraction(r) {
|
alertBackgroundFraction(r) {
|
||||||
let fraction = r.output;
|
let fraction = r.output;
|
||||||
let percentage = (fraction * 100).toFixed(1);
|
// let percentage = (fraction * 100).toFixed(0);
|
||||||
this.modalNotify(`Current image is ${percentage}% background.`);
|
this.modalNotify(`Current image is ${fraction.toFixed(0)}% background.`);
|
||||||
|
},
|
||||||
|
alertBackgroundSet() {
|
||||||
|
this.modalNotify(`Background image has been updated`);
|
||||||
|
},
|
||||||
|
alertImageLabel(r) {
|
||||||
|
let label = r.output===true? 'sample' : 'background'
|
||||||
|
this.modalNotify(`Current image is ${label}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue