added methods to get the image, width and height
This commit is contained in:
@ -77,6 +77,29 @@ class CameraClient:
|
|||||||
def clear_buffer(self):
|
def clear_buffer(self):
|
||||||
caput(self.name + ":CLEARMEM", 1) # Clear Buffer
|
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):
|
def get_max_roi(self):
|
||||||
current_roi = self.get_roi()
|
current_roi = self.get_roi()
|
||||||
self.reset_roi()
|
self.reset_roi()
|
||||||
|
Reference in New Issue
Block a user