update plot example

This commit is contained in:
ykcheung
2026-01-30 20:04:23 +08:00
parent 00b0c7b339
commit def7dd6916
3 changed files with 197 additions and 2 deletions
+4 -2
View File
@@ -96,7 +96,7 @@ def compute_dense_optical_flow_simple(prev_gray, curr_gray):
def main_simple():
# Initialize camera
sensor = orisys.Sensor('s1.mp4', config_name="prototype", cal_path= "./config/cal.npy", isstitch=True, cuda=True, verbose=True)
sensor = orisys.Sensor('s1.mp4', config_name="./config/prototype_of3.json", cal_path= "./config/cal.npy", isstitch=True, cuda=True, verbose=True)
model = setup_simple_raft()
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Using device: {device}")
@@ -118,6 +118,8 @@ def main_simple():
sensor.get_img()
frame = sensor.img.copy()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
if prev_gray is None:
prev_gray = frame.copy
gray = frame
# Compute optical flow
if prev_gray is not None:
@@ -202,7 +204,7 @@ def main_simple():
# cv2.imshow('Grayscale', gray)
cv2.imshow('Optical Flow', arrows)
prev_gray = gray.copy()
# prev_gray = gray.copy()
#步骤 3.5: 键盘控制
key = cv2.waitKey(1) & 0xFF