diff options
Diffstat (limited to 'decoder.py')
-rw-r--r-- | decoder.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -73,7 +73,12 @@ while data is None: u = queue.popleft() for d in [(1, 0), (0, 1), (-1, 0), (0, -1)]: v = (u[0] + d[0], u[1] + d[1]) - if 0 <= v[0] < X and 0 <= v[1] < Y and not vis[v] and np.linalg.norm(raw_frame[v] - raw_frame[s]) < 125: + if ( + 0 <= v[0] < X + and 0 <= v[1] < Y + and not vis[v] + and np.linalg.norm(raw_frame[v] - raw_frame[s]) < 125 + ): vis[v] = True pos += np.array(v) col += raw_frame[v] @@ -132,7 +137,9 @@ while data is None: raw_color_frame = raw_frame[np.round(xp).astype(np.int64), np.round(yp).astype(np.int64), :] # color_frame = raw_color_frame.astype(np.uint8) color_frame = np.clip(np.squeeze(F @ (raw_color_frame - origin)[..., np.newaxis]), 0, 255).astype(np.uint8) - frame = (color_frame[:, :, 0] >> 5) + (color_frame[:, :, 1] >> 2 & 0b00111000) + (color_frame[:, :, 2] & 0b11000000) + frame = ( + (color_frame[:, :, 0] >> 5) + (color_frame[:, :, 1] >> 2 & 0b00111000) + (color_frame[:, :, 2] & 0b11000000) + ) frame_data = np.concatenate( ( frame[:cheight, cwidth : args.width - cwidth].flatten(), |