颜色识别

单颜色彩色识别

# Single Color RGB565 Blob Tracking Example单色RGB565斑点跟踪示例
#
# This example shows off single color RGB565 tracking using the OpenMV Cam.这个例子展示了使用OpenMV Cam的单色RGB565跟踪。import sensor, image, time#导入此代码所依赖的模块threshold_index = 1 # 0 for red, 1 for green, 2 for blue# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
# The below thresholds track in general red/green/blue things. You may wish to tune them...
#设置所要识别的颜色的预置
thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds(48, 83, -128, 23, 15, 59), # generic_green_thresholds(0, 30, 0, 64, -128, 0)] # generic_blue_thresholdssensor.reset()#重置感光元件、摄像机
sensor.set_pixformat(sensor.RGB565)#设置颜色格式
sensor.set_framesize(sensor.QVGA)#设置图像大小
sensor.skip_frames(time = 2000)#跳过前几帧,等待前两个设置生效
#图像识别时必须关闭白平衡和自动增益,因为他们会影响颜色阈值
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()#返回一个时钟对象。# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are只有像素大于“pixel_threshold”和面积大于“area_threshold”的blobs才是
# 由下面的“find_blobs”返回。修改“pixels_threshold”和“area_threshold”即可
# camera resolution. "merge=True" merges all overlapping blobs in the image.相机的分辨率。“merge=True”合并图像中所有重叠的斑点。while(True):clock.tick()#开始追踪运行时间。img = sensor.snapshot()#先截感光元件的一张照片#for...in循环,依次把list或tuple中的每个元素迭代出来#用for循环,把所有符合条件的色块找一遍for blob in img.find_blobs([thresholds[threshold_index]], pixels_threshold=200, area_threshold=200, merge=True):# These values are stable all the time.这些值一直是稳定的img.draw_rectangle(blob.rect())#给色块画一个外框img.draw_cross(blob.cx(), blob.cy())#在色块外框的中心画一个+print(blob.cx(), blob.cy())print(clock.fps())#打印帧率

相关知识点





find_blobs函数

多颜色彩色识别

# 多颜色斑点跟踪示例
#
# 这个例子展示了使用OpenMV摄像头的多色斑点跟踪。import sensor, image, time# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
# The below thresholds track in general red/green things. You may wish to tune them...
thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds(30, 100, -64, -8, -32, 32), # generic_green_thresholds(0, 15, 0, 40, -80, -20)] # generic_blue_thresholds
# 您可以超过16个以上的阈值。然而,在颜色阈值开始严重重叠之前,用16个阈值分割任何场景是不可能的。sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
# camera resolution. Don't set "merge=True" becuase that will merge blobs which we don't want here.
#不要设置"merge=True"因为那会合并我们不想要的blobs。while(True):clock.tick()img = sensor.snapshot()for blob in img.find_blobs(thresholds,merge=False, pixels_threshold=200, area_threshold=200):# These values are stable all the time.img.draw_rectangle(blob.rect())img.draw_cross(blob.cx(), blob.cy())print(blob.code())#print(clock.fps())

【星曈科技】OpenMv笔记——单颜色彩色识别相关推荐

  1. OpenMv单颜色彩色识别

    这是OpenMv的自带例程,用于单颜色彩色识别 追踪小球是OpenMV用的最多的功能了 OpenMv单颜色彩色识别 1 重点讲解 thresholds roi x_stride y_stride in ...

  2. 根据星瞳科技openmv巡线小车所改进的巡线方案

    首先看一下星瞳科技的巡线方案(附上其开源源码): THRESHOLD = (5, 70, -23, 15, -57, 0) # Grayscale threshold for dark things. ...

  3. openmv 神经网络 超出内存_星瞳科技OpenMV视频教程22-神经网络cifar_10

    视频第一部分:https://www.zhihu.com/video/1021334023171338240 视频第二部分:https://www.zhihu.com/video/1021334038 ...

  4. OpenMV的单颜色识别讲解

    OpenMV的官方教程:寻找色块:single_color_rgb565_blob_tracking示例讲解:视频讲解 需要提前看的文章:程序烧录:颜色阈值设置 目录 threshold_index和 ...

  5. 【星曈科技】OpenMv笔记——利用OpenMV与STM32进行串口通信

    利用OpenMV与STM32进行串口通信 OpenMV端的程序 # Untitled - By: dell - 周一 7月 19 2021# Blob Detection and uart trans ...

  6. 星瞳科技 OpenMV 的使用

    2019 电子设计大赛 激光炮题目 写的程序 依赖: usart_all.h usart_all.c 见 STM32超级通用串口程序(秘籍) 调用场景: 淘晶驰串口屏 代码: camera.h : # ...

  7. 一周AI创业:MIT博士领衔星药科技获新融资,自动驾驶再掀资本狂潮

    智源社区 AI 创业周报关注早期有潜在影响力的AI创业团队,挖掘新的场景和技术应用范式,同时希望通过采访和其他信息聚合的方式搜集创业观点,为AI创业者提供更有价值的行业洞察. 本周获得融资的AI创业团 ...

  8. 星宸科技SSD202D芯片+无线投屏协议在摩托车智能仪表,电动车智能仪表批量出货。

    星宸科技股份有限公司(前身MStar)的嵌入式CPU芯片SSD202D,SSC8826Q等在摩托车仪表.电动车智能仪表产品大批量出货,支持无线蓝牙.WIFI无线投屏,行车记录仪等功能.产品得到摩托车爱 ...

  9. 星环科技如何站稳脚跟?

    基础软件市场巨头林立,星环科技如何站稳脚跟?| 爱分析调研 2017-08-08 08:00 http://www.sohu.com/a/163011476_545428 以Hadoop发行版起家的星 ...

最新文章

  1. 推荐|5种商业AI产品的技术架构设计!
  2. IIS部署ASP.Net Core 502.5错误和解决
  3. 6 种不同情况下写的代码
  4. [转]移动应用统一化的谎言:一次编译,到处运行不可能
  5. 总结一下嵌入式OLED显示屏显示中文汉字的办法
  6. 7种有害的IT团队行为,不根除就坏大事了
  7. 基于MongoDB与NodeJS构建物联网系统
  8. 使用MDScratchImageView实现刮奖效果
  9. Linux配置java环境变量
  10. scrapy_redis爬取统计局的城乡代码,以目录文件夹形式生成,同时最后保存在excel和redis数据库中
  11. modbus tcp调试助手_集成20几个功能的电气调试软件大放送,永久免费、持续升级...
  12. 超酷!Python 绘制属于你的世界地图
  13. html5三国策略,HTML5新游《乱弹三国》今日首曝
  14. cubieboard
  15. 订阅者Subscriber的编程实现——ROS
  16. 用python 打印等腰三角形
  17. 通过云效 CI/CD 实现微服务全链路灰度
  18. 如何阅读一本专业书?
  19. 【Python】天气预报(发送网易邮件,微信公众测试号,企业微信),周末用时一天,两万字代码,纯肝货(完整项目)一一CSDN21天学习挑战赛
  20. 机器学习常用算法归详细纳整理

热门文章

  1. 分析暴力的满天发红包~【方便虽好,安全第一~】
  2. oracle 查询语句取别名,实用sql查询语句详解1:给列取别名、查询部分行、多列排序...
  3. FarPoint.Win.Spread 表格 鼠标悬停 展示表格数据 并且控制每行字数 代码备忘
  4. 投资理财-木兰也挺好
  5. 面试官:工作中遇到难题怎么解决的?看似送分题实则”送命”
  6. TVM/onnx-mlir/Glow 的简单理解
  7. 解决IE11中无法加载flash
  8. c语言中字母用什么,写c语言代码的时候一般用什么输入法
  9. PHP-SOCKETS读书笔记1-3
  10. 腾讯云Intel Xeon Cascade Lake 8255C(2.5 GHz)处理器CPU性能评测