aboutsummaryrefslogtreecommitdiff
path: root/decoder.py
diff options
context:
space:
mode:
authorAnthony Wang2024-05-13 19:45:14 -0400
committerAnthony Wang2024-05-13 19:45:14 -0400
commit57a2ecb485d3814b85f4c22c9b48f1de053750eb (patch)
tree436cdf7a3b2b78069c5e3ce383aad68a227b285a /decoder.py
parent05e4dfbd5b9ddee59f6d42a608612f11102b61fe (diff)
Revert "Use medians for deciding color, seems to work well in practice"
This reverts commit 05e4dfbd5b9ddee59f6d42a608612f11102b61fe.
Diffstat (limited to 'decoder.py')
-rw-r--r--decoder.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/decoder.py b/decoder.py
index 235a5f6..b23d623 100644
--- a/decoder.py
+++ b/decoder.py
@@ -99,11 +99,7 @@ while data is None:
)
frame = cv2.warpPerspective(raw_frame, M, (args.width, args.height))
# Convert to new color space
- frame = np.squeeze(F @ (frame - origin)[..., np.newaxis])
- rmed = np.median(frame[:,:,0])
- gmed = np.median(frame[:,:,1])
- bmed = np.median(frame[:,:,2])
- frame = np.dstack((frame[:,:,0] > rmed, frame[:,:,1] > gmed, frame[:,:,2] > bmed)).astype(np.uint8)
+ frame = (np.squeeze(F @ (frame - origin)[..., np.newaxis]) >= 160).astype(np.uint8)
frame = np.packbits(
np.concatenate(
(