YantaiVisionX/tools/calibrate_roi.py
root 2ff9c2b0bb feat: 初始化YantaiVisionX LED灯阵监控系统
- 添加完整的项目文档(README.md, design.md, CLAUDE.md)
- 实现核心检测算法:ROI管理、峰值检测、帧间稳定
- 支持实时摄像头检测和视频文件处理
- 包含图像预处理:去雾、几何校正、图像增强
- 提供多种输出格式:JSON、CSV、矩阵、文本
- 实现双阈值检测算法适应雾天环境
- 添加ROI标定工具和配置文件管理

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-12 10:33:19 +08:00

58 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""
ROI标定演示脚本
使用测试图像进行ROI区域标定
"""
import sys
import os
# 添加项目根目录到路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from tools.roi_calibration_tool import ROICalibrationTool
def main():
"""
主函数
"""
print("YantaiVisionX ROI标定工具")
print("=" * 50)
# 获取图像路径
if len(sys.argv) > 1:
image_path = sys.argv[1]
else:
# 提示用户输入图像路径
image_path = input("请输入标定图像路径: ").strip()
if not os.path.exists(image_path):
print(f"错误: 图像文件不存在 - {image_path}")
return
print(f"加载标定图像: {image_path}")
# 创建标定工具
tool = ROICalibrationTool()
print("\n标定说明:")
print("1. 按照3排×6列的布局标定18个LED灯")
print("2. ROI命名: R1C1, R1C2, ..., R3C6")
print("3. 从左上角开始按行优先顺序点击每个LED中心")
print("4. 操作键:")
print(" - 鼠标左键: 标定当前ROI中心点")
print(" - R键: 重置所有标定")
print(" - S键: 保存配置并退出")
print(" - +/-键: 调整ROI大小")
print(" - Q键/ESC: 退出不保存")
print("\n开始标定...")
# 运行标定
tool.run_calibration(image_path)
print("标定完成!")
if __name__ == "__main__":
main()