changed stream resolution list from ratio

- changed the resolution list to be the actual resolution instead of ratio 
- changed development port to be 5800
This commit is contained in:
ori agranat
2019-11-05 21:15:10 +02:00
parent ac7bd48d87
commit 0881880b86
4 changed files with 28 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
import org.opencv.core.Mat;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@@ -304,9 +305,14 @@ public class Camera {
}
}
public List<String> getResolutionList() {
public List<HashMap> getResolutionList() {
return Arrays.stream(availableVideoModes)
.map(res -> String.format("%sx%s@%sFPS, %s", res.width, res.height, res.fps, res.pixelFormat.toString()))
.map(res -> new HashMap<String,Object>(){{
put("width", res.width);
put("height", res.height);
put("fps", res.fps);
put("pixelFormat", res.pixelFormat);
}})
.collect(Collectors.toList());
}

View File

@@ -4,7 +4,7 @@ public enum StreamDivisor {
none(1),
half(2),
quarter(4),
sixth(6);
eighth(8);
public final Integer value;

View File

@@ -8,7 +8,7 @@ import msgPack from 'msgpack5';
Vue.config.productionTip = false;
// Vue.use(VueNativeSock,'ws://' + location.host + '/websocket',{format: 'json'});
Vue.use(VueNativeSock, 'ws://' + location.hostname + ':8888/websocket');
Vue.use(VueNativeSock, 'ws://' + location.hostname + ':5800/websocket');
Vue.prototype.$msgPack = msgPack(true);
Vue.mixin({
methods: {

View File

@@ -3,7 +3,7 @@
<CVselect name="Camera" :list="cameraList" v-model="currentCameraIndex"/>
<CVselect name="Resolution" v-model="cameraSettings.resolution" :list="resolutionList"/>
<CVselect name="Stream Resolution" v-model="cameraSettings.streamDivisor"
:list="['1:1','1:2','1:4','1:6']"/>
:list="streamResolutionList"/>
<CVnumberinput name="Diagonal FOV" v-model="cameraSettings.fov"/>
<v-btn style="margin-top:10px" small color="#4baf62" @click="sendCameraSettings">Save Camera Settings</v-btn>
</div>
@@ -29,7 +29,6 @@
},
computed: {
currentCameraIndex: {
get() {
return this.$store.state.currentCameraIndex;
@@ -48,7 +47,23 @@
},
resolutionList: {
get() {
return this.$store.state.resolutionList;
let tmp_list = [];
for (let i of this.$store.state.resolutionList){
tmp_list.push(`${i['width']} X ${i['height']} at ${i['fps']} FPS, ${i['pixelFormat']}`)
}
return tmp_list;
}
},
streamResolutionList:{
get(){
let cam_res = this.$store.state.resolutionList[this.cameraSettings.resolution];
let tmp_list = [];
let x = 1;
for (let i = 0; i < 4; i++){
tmp_list.push(`${cam_res['width']/x} X ${cam_res['height']/x}`);
x *= 2;
}
return tmp_list;
}
},
cameraSettings: {