Skip to content

Commit

Permalink
warn if teax image has resolution mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jveitchmichaelis authored Oct 2, 2020
1 parent ada3e02 commit 603d0c6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions flirpy/camera/tau.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,18 @@ def _sync_uart(self, allow_timeout=False):
break

return data[data.find(magic):]

def _convert_frame(data, to_temperature=False, width=640):
# This is reported by the camera. Some cameras may default to other settings.
frame_width = np.frombuffer(data[5:7], dtype='uint16')[0]

# Remove start/end markers and correct if wrong width specified
if frame_width - 2 != width:
log.warn("Received frame width is {}, expected {}. Please check your camera default resolution."
.format(frame_width, width))
width = frame_width

def _convert_frame(self, data, to_temperature=True):
raw_image = np.frombuffer(data[10:], dtype='uint8').reshape((512,2*642))
raw_image = np.frombuffer(data[10:], dtype='uint8').reshape((-1,2*(width+2)))
raw_image = 0x3FFF & raw_image.view('uint16')[:,1:-1]

if to_temperature:
Expand Down

0 comments on commit 603d0c6

Please sign in to comment.