diff --git a/backend/app/classes/SettingsManager.py b/backend/app/classes/SettingsManager.py index a1933011b..74989873f 100644 --- a/backend/app/classes/SettingsManager.py +++ b/backend/app/classes/SettingsManager.py @@ -122,8 +122,8 @@ class SettingsManager(metaclass=Singleton): if "exposure" in dic: self.usb_cameras[camera_name].setExposureManual(dic["exposure"]) - if "video_mode" in dic: - self.usb_cameras[camera_name].setVideoMode(dic["video_mode"]) + if "resolution" in dic: + self.usb_cameras[camera_name].setVideoMode(self.usb_cameras[camera_name].enumerateVideoModes()[int(dic["resolution"])]) # Access methods @@ -133,6 +133,17 @@ class SettingsManager(metaclass=Singleton): raise NoCameraConnectedException() + def get_resolution_list(self): + if self.general_settings["curr_camera"]: + str_list = [] + for val in self.usb_cameras[self.general_settings["curr_camera"]].enumerateVideoModes(): + str_list.append("{width} X {height} at {fps} fps".format(width=str(val.width), + height=str(val.height), fps=str(val.fps))) + + return str_list + + raise NoCameraConnectedException() + def get_curr_cam(self): if self.general_settings["curr_camera"]: return self.cams[self.general_settings["curr_camera"]] diff --git a/backend/app/handlers/SocketHandler.py b/backend/app/handlers/SocketHandler.py index 909878614..5db7edc60 100644 --- a/backend/app/handlers/SocketHandler.py +++ b/backend/app/handlers/SocketHandler.py @@ -7,7 +7,7 @@ from ..classes.SettingsManager import SettingsManager class ChameleonWebSocket(tornado.websocket.WebSocketHandler): actions = {} - set_this_camera_settings = ["exposure", "brightness", "video_mode"] + set_this_camera_settings = ["exposure", "brightness", "resolution"] def __init__(self, application, request, **kwargs): super().__init__(application, request, **kwargs) @@ -64,6 +64,7 @@ class ChameleonWebSocket(tornado.websocket.WebSocketHandler): try: full_settings.update(self.settings_manager.get_curr_pipeline()) full_settings["pipelineList"] = list(self.settings_manager.cams[self.settings_manager.general_settings["curr_camera"]]["pipelines"].keys()) + full_settings["resolutionList"] = self.settings_manager.get_resolution_list() except NoCameraConnectedException: # TODO: return something if no camera connected full_settings["data"] = None diff --git a/backend/settings/cams/USB Camera-B4.09.24.1.json b/backend/settings/cams/USB Camera-B4.09.24.1.json index 2397af2ee..d9db1abbb 100644 --- a/backend/settings/cams/USB Camera-B4.09.24.1.json +++ b/backend/settings/cams/USB Camera-B4.09.24.1.json @@ -1 +1 @@ -{"pipelines": {"pipeline0": {"exposure": 34, "brightness": 11, "orientation": "Normal", "resolution": 1, "hue": [50, 58], "saturation": [65, 76], "value": [63, 79], "erode": false, "dilate": false, "area": [0, 100], "ratio": [0, 20], "extent": [0, 100], "is_binary": "Normal"}}, "path": "/dev/v4l/by-path/pci-0000:02:03.0-usb-0:1:1.0-video-index0", "video_mode": {"fps": 187, "width": 320, "height": 240, "pixel_format": "kYUYV"}} \ No newline at end of file +{"pipelines": {"pipeline0": {"exposure": 99, "brightness": 0, "orientation": "Inverted", "resolution": 14, "hue": [50, 58], "saturation": [65, 76], "value": [63, 79], "erode": false, "dilate": false, "area": [0, 100], "ratio": [0, 20], "extent": [0, 100], "is_binary": "Normal"}}, "path": "/dev/v4l/by-path/pci-0000:02:03.0-usb-0:1:1.0-video-index0", "video_mode": {"fps": 187, "width": 320, "height": 240, "pixel_format": "kYUYV"}} \ No newline at end of file diff --git a/chameleon-client/src/components/InputTab.vue b/chameleon-client/src/components/InputTab.vue index c13b4104f..07737f056 100644 --- a/chameleon-client/src/components/InputTab.vue +++ b/chameleon-client/src/components/InputTab.vue @@ -4,13 +4,14 @@ - + + + \ No newline at end of file diff --git a/chameleon-client/src/store.js b/chameleon-client/src/store.js index 03647c86d..19856c3df 100644 --- a/chameleon-client/src/store.js +++ b/chameleon-client/src/store.js @@ -17,7 +17,8 @@ export const store = new Vuex.Store({ exposure:54, brightness:0, orientation:0, - resolution:[], + resolution:0, + resolutionList:[], //threshold hue:[0,10], saturation:[0,10],