# OPENMV_CODE_READ **Repository Path**: iamttp/OPENMV_CODE_READ ## Basic Information - **Project Name**: OPENMV_CODE_READ - **Description**: openmv代码阅读 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-03-27 - **Last Updated**: 2022-10-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OPENMV 代码阅读 * 默认执行点检查 ```python class ctrl(object): work_mode = 0x01 #工作模式.默认是点检测,可以通过串口设置成其他模式 check_show = 1 #开显示,在线调试时可以打开,离线使用请关闭,可提高计算速度 ``` * 默认分辨率80x60 ```python sensor.set_framesize(sensor.QQQVGA) # 80x60 ``` * 循环执行 ```python while(True): clock.tick() if (ctr.work_mode&0x01)!=0: img = sensor.snapshot() check_dot(img) #线检测 if (ctr.work_mode&0x02)!=0: img = sensor.snapshot().binary([THRESHOLD]) check_line(img) #接收串口数据 uart_read_buf() ``` 1. 工作模式一 * 修改代码,查看最大点的坐标以及总的像素数目。`thresholds = [0, 90]#自定义灰度阈值` ```python #点检测函数 def check_dot(img): for blob in img.find_blobs([thresholds], pixels_threshold=3, area_threshold=3, merge=True, margin=5): if dot.pixels