Skip to content

Commit 038450a

Browse files
committed
optimize thermal night vision
1 parent 70b346b commit 038450a

File tree

1 file changed

+9
-5
lines changed
  • projects/app_thermal256_nightvision

1 file changed

+9
-5
lines changed

projects/app_thermal256_nightvision/main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@ def dbg_time(name, t):
1919

2020
# --- 1. 系统配置 ---
2121
ts = touchscreen.TouchScreen()
22-
disp = display.Display()
23-
print(f"display size: {disp.width()}x{disp.height()}")
22+
cam_w = 640
23+
cam_h = 480
24+
2425
old_ai_isp = int(app.get_sys_config_kv("npu", "ai_isp", "0"))
2526
app.set_sys_config_kv("npu", "ai_isp", "1")
2627

27-
# --- 2. 摄像头初始化 ---
28+
# --- 2. 摄像头/屏幕初始化 ---
2829
print("Init Camera...")
2930
cam = None
3031
try:
31-
cam = camera.Camera(disp.width(), disp.height())
32+
cam = camera.Camera(cam_w, cam_h)
3233
print("Camera Init Success")
3334
except Exception as e:
3435
print(f"Camera Init Failed: {e}")
3536

37+
disp = display.Display()
38+
print(f"display size: {disp.width()}x{disp.height()}")
39+
3640
image.load_font("sourcehansans", "/maixapp/share/font/SourceHanSansCN-Regular.otf", size = 20)
3741

3842
img = image.Image(320, 240)
@@ -405,7 +409,7 @@ def process_touch(ts, w, h, state):
405409

406410
now = time.ticks_ms()
407411
# 帧率计算修正为 (last, now)
408-
print(f"==========={time.ticks_diff(last_frame_ms, now)} ms")
412+
# print(f"loop {time.ticks_diff(last_frame_ms, now)} ms")
409413
last_frame_ms = now
410414

411415
# Mode 1,2,3

0 commit comments

Comments
 (0)