diff options
author | Anthony Wang | 2024-04-30 13:19:20 -0400 |
---|---|---|
committer | Anthony Wang | 2024-04-30 13:19:20 -0400 |
commit | 49e4564566bbfd8435f390bba602eb97cc214502 (patch) | |
tree | 05c5318fca7714c4f7e57af2853b55309caf6ad5 /decoder.py | |
parent | fcadaffeedc1438942ae7f4de99ec980464386e4 (diff) |
Add more comments
Diffstat (limited to 'decoder.py')
-rw-r--r-- | decoder.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,8 +1,6 @@ import argparse import traceback import cv2 - -# import matplotlib.pyplot as plt import numpy as np from creedsolo import RSCodec from raptorq import Decoder @@ -57,12 +55,14 @@ while data is None: break # 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 widx, wcol = find_corner(raw_frame[:cx, :cy], lambda B: np.sum(B, axis=2) - np.std(B, axis=2)) @@ -95,7 +95,9 @@ 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]) >= 128).astype(np.uint8) + # import matplotlib.pyplot as plt # plt.imshow(frame * 255) # plt.show() frame = np.concatenate( |