Skip to content

Commit

Permalink
Merge pull request #95 from portugueslab/add_avt_interlacing
Browse files Browse the repository at this point in the history
Add interlacing support
  • Loading branch information
kkoetter authored Mar 5, 2024
2 parents 14c23ac + a371920 commit 9e93af8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion stytra/hardware/video/cameras/avt.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ class AvtCamera(Camera):
"""

def __init__(self, camera_id=None, **kwargs):
def __init__(self, camera_id=None, interlacing=False, **kwargs):
# Set timeout for frame acquisition. Give this as input?
self.timeout_ms = 1000
self.camera_id = camera_id
self.interlacing = interlacing # some cameras look like they have a double image, these should be interlaced.

super().__init__(**kwargs)

Expand Down Expand Up @@ -111,6 +112,12 @@ def read(self):
shape=(self.frame.data.height, self.frame.data.width),
)

if self.interlacing:
new_frame = np.empty(frame.shape, dtype=np.uint8)
new_frame[1::2] = frame[:246]
new_frame[::2] = frame[246:]
frame = new_frame

except VimbaException:
frame = None

Expand Down

0 comments on commit 9e93af8

Please sign in to comment.