Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _run_continuous_shot(self, grab_strategy=pylon.GrabStrategy_LatestImageOnly,
window_size=None, image_folder='.'):
self._camera.StopGrabbing()
# converting to opencv bgr format
converter = pylon.ImageFormatConverter()
converter.OutputPixelFormat = pylon.PixelType_BGR8packed
converter.OutputBitAlignment = pylon.OutputBitAlignment_MsbAligned
if(not self._impro_own_window):
cv2.namedWindow('camera_image', cv2.WINDOW_NORMAL | cv2.WINDOW_GUI_NORMAL)
if(window_size is not None):
cv2.resizeWindow('camera_image', window_size[0], window_size[1])
self._camera.StartGrabbing(grab_strategy)
try:
while(self._camera.IsGrabbing()):
try:
setattr(self._cam, k, v)
self.debug('Set {} to {}'.format(k, v))
except ValueError as e:
self.warning('Invalid Property value. k="{}",v={}. e={}'.format(k, v, e))
except KeyError:
self.warning('Invalid Camera Property "{}"'.format(k))
except RuntimeError as e:
self.warning('RunTimeError: {}. k={},v={}'.format(e, k, v))
except IOError as e:
self.warning('IOError: {}, k={}, v={}'.format(e, k, v))
except genicam.AccessException as e:
self.warning('Access Exception {}'.format(e))
self.pixel_depth = self._cam.PixelDynamicRangeMax.Value
self._cam.StartGrabbing(pylon.GrabStrategy_LatestImageOnly)