Skip to content

Commit

Permalink
Drop first frame in acquisition loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ivalaginja committed Apr 22, 2024
1 parent 6502047 commit 4e07258
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions catkit2/services/hamamatsu_camera/hamamatsu_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def acquisition_loop(self):
self.log.warning('Timeout while waiting for frame')
if self.cam.wait_capevent_frameready(timeout_millisec) is False:
raise RuntimeError(f'Dcam.wait_capevent_frameready({timeout_millisec}) fails with error {self.cam.lasterr()}')

if self.cam.buf_getframedata(-2) is False:
# If there is no second to last frame, it means we just acquired the first frame.
# In this case, drop the current frame since it always contains systematic errors.
continue

img = self.cam.buf_getlastframedata()
self.images.submit_data(img.astype('float32'))

Expand Down

0 comments on commit 4e07258

Please sign in to comment.