aboutsummaryrefslogtreecommitdiff
path: root/decoder.py
diff options
context:
space:
mode:
authorAnthony Wang2024-05-12 23:39:18 -0400
committerAnthony Wang2024-05-12 23:39:18 -0400
commita1d77a466dcc694f0101d2588529ada8c858ed94 (patch)
tree436cdf7a3b2b78069c5e3ce383aad68a227b285a /decoder.py
parent3d0382268958a5923fe3eb1df8161c78375fcf93 (diff)
Minor tweaks for 0.3mbps -> 1.8 mbps
Diffstat (limited to 'decoder.py')
-rw-r--r--decoder.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/decoder.py b/decoder.py
index a1c0d51..b23d623 100644
--- a/decoder.py
+++ b/decoder.py
@@ -61,17 +61,13 @@ while data is None:
print("Skipped")
continue
# raw_frame is a uint8 BE CAREFUL
- if type(args.input) == int:
- # Crop image to reduce camera distortion
- X, Y = raw_frame.shape[:2]
- raw_frame = raw_frame[X // 4 : 3 * X // 4, Y // 4 : 3 * Y // 4]
cv2.imshow("", raw_frame)
cv2.waitKey(1)
raw_frame = cv2.cvtColor(raw_frame, cv2.COLOR_BGR2RGB)
# Find positions and colors of corners
X, Y = raw_frame.shape[:2]
- cx, cy = X // 3, Y // 3
+ cx, cy = X // 4, Y // 4
widx, wcol = find_corner(raw_frame[:cx, :cy], lambda B: np.sum(B, axis=2) - 2 * np.std(B, axis=2))
ridx, rcol = find_corner(raw_frame[:cx, Y - cy :], lambda B: B[:, :, 0] - B[:, :, 1] - B[:, :, 2])
ridx[1] += Y - cy
@@ -103,7 +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]) >= 192).astype(np.uint8)
+ frame = (np.squeeze(F @ (frame - origin)[..., np.newaxis]) >= 160).astype(np.uint8)
frame = np.packbits(
np.concatenate(
(