diff --git a/cameras/cameraclient.py b/cameras/cameraclient.py index 809bfaf..6f52148 100644 --- a/cameras/cameraclient.py +++ b/cameras/cameraclient.py @@ -77,6 +77,29 @@ class CameraClient: def clear_buffer(self): caput(self.name + ":CLEARMEM", 1) # Clear Buffer + def width(self): + res = caget(self.name + ":WIDTH") + if res is None: + raise RuntimeError("Could not caget width") + return int(res) + + def height(self): + res = caget(self.name + ":HEIGHT") + if res is None: + raise RuntimeError("Could not caget height") + return int(res) + + def get(self): + waveform = caget(self.name + ":FPICTURE") + if waveform is None: + raise RuntimeError("Could not caget waveform") + width = self.width() + height = self.height() + length = width * height + waveform = waveform[:length] + image = waveform.reshape(height, width) + return image + def get_max_roi(self): current_roi = self.get_roi() self.reset_roi()