added methods to get the image, width and height

This commit is contained in:
2020-07-01 14:18:27 +02:00
parent 4c6101a13f
commit 3431a2602f

View File

@ -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()