Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_newest_frame(self):
if self.live == 1:
if self.grab_status:
with self.icam.RetrieveResult(200, py.TimeoutHandling_Return) as result:
image = cv2.cvtColor(result.Array, cv2.COLOR_RGB2HSV)
self.frame_count = self.frame_count + 1
self.__calc_frametime(time.time())
return image
else:
raise Exception('Camera not Grabbing')
else:
if self.cap.isOpened() or True:
ret, frame = self.cap.read()
self.frame_count = self.frame_count + 1
self.__calc_frametime(time.time())
def read(self):
ok, img = False, None
if self._cam and not self._setting_config:
res = self._cam.RetrieveResult(0, pylon.TimeoutHandling_Return)
if res.IsValid():
ok = True
img = res.Array
res.Release()
return ok, img