资源简介
OpenMV形状识别And颜色识别!
代码片段和文件信息
# Blob Detection Example
#
# This example shows off how to use the find_blobs function to find color
# blobs in the image. This example in particular looks for dark green objects.
import sensor image time
# For color tracking to work really well you should ideally be in a very very
# very controlled enviroment where the lighting is constant...
red_threshold_01 = (120 160 0 40 0 40)
#设置红色的阈值,括号里面的数值分别是L A B 的最大值和最小值(minL maxL minA
# maxA minB maxB),LAB的值在图像左侧三个坐标图中选取。如果是灰度图,则只需
#设置(min max)两个数字即可。
# You may need to tweak the above settings for tracking green things...
# Select an area in the framebuffer to copy the color settings.
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # use RGB565.
sensor.set_framesize(sensor.QQVGA) # use QVGA for quailtiy use QQVGA for speed.
sensor.skip_frames(10) # Let new settings take affect.
sensor.set_auto_whitebal(False)
#关闭白平衡。白平衡是默认开启的,在颜色识别中,需要关闭白平衡。
clock = time.clock() # Tracks FPS.
‘‘‘
扩宽roi
‘‘‘
def expand_roi(roi):
# set for QQVGA 160*120
extra = 5
win_size = (160 120)
(x y width height) = roi
new_roi = [x-extra y-extra width+2*extra height+2*extra]
if new_roi[0] < 0:
new_roi[0] = 0
if new_roi[1] < 0:
new_roi[1] = 0
if new_roi[2] > win_size[0]:
new_roi[2] = win_size[0]
if new_roi[3] > win_size[1]:
new_roi[3] = win_size[1]
return tuple(new_roi)
while(True):
clo
- 上一篇:100个经典Python
- 下一篇:复旦大学人工智能N-Queens答案
相关资源
- openmv二维码识别
- openmv控制舵机
- openmv一次性识别红黄蓝三种颜色
- 工程训练大赛openmv二维码、色环、色
- OpenMV交通灯识别例程
- openmv颜色识别代码
- openmv 识别3个颜色 工程训练大赛
- OpenMV4四代原理图与PCB.zip
- 小车基于openmv摄像头的红灯识别
- openmv定点代码
- 2020电赛G题openmv程序
- Openmv主控物料分拣小车拣乒乓球小车
- Openmv主控物料分拣小车拣乒乓球小车
- 官方OpenMV4.zip
- openmv智能小车寻线代码
- 颜色识别+串口通信——华北五省ope
- openmv识别红绿蓝物块颜色,并输出物
- 工训物流小车颜色及二维码识别
- OPENMV用作光流模组程序
- openmv识别红色,串口通信,可用于信
- 基于OpenMV与STM32的寻球小车.rar
- openmv目标检测代码
-
xm
l_cascade.py opencv_traincascade.exe ope - OpenMV视觉识别 舵机云台颜色跟踪
- openmv识别物块颜色,并输出物块距离
- openmv识别特定颜色且打印坐标到串口
评论
共有 条评论