91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-01-30
  • 語言: Python
  • 標(biāo)簽: openmv??

資源簡介

openmv一次性識別紅黃藍(lán)三種顏色,通過調(diào)整閾值適應(yīng)不同環(huán)境。

資源截圖

代碼片段和文件信息

import?sensor?image?time?pyblcd
from?pyb?import?UART
from?pyb?import?LED
red_threshold?=?(3481978873)?#?red_thresholds?紅色閾值
green_threshold??=?(2550-4040560)?#?green_thresholds?綠色閾值
blue_threshold??=?(42?72?-60?16?-26?-67)#?blue_thresholds?藍(lán)色閾值

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time?=?3000)
sensor.set_auto_gain(False)?#?must?be?turned?off?for?color?tracking
sensor.set_auto_whitebal(False)?#?must?be?turned?off?for?color?tracking
#sensor.set_vflip(True)#垂直翻轉(zhuǎn)
#sensor.set_hmirror(True)#水平翻轉(zhuǎn)
r_led?=?LED(1)
b_led?=?LED(3)
clock?=?time.clock()
uart?=?UART(3?115200)?#打開串口
uart.init(115200?bits=8?parity=None?stop=1)?#位寬度參數(shù)bits=8,奇偶校驗(yàn)參數(shù)parity=None停止位參數(shù)stop=1
#?只有比“pixel_threshold”多的像素和多于“area_threshold”的區(qū)域才被
#?下面的“find_blobs”返回。?如果更改相機(jī)分辨率,
#?請更改“pixels_threshold”和“area_threshold”。?“merge?=?True”合并圖像中所有重疊的色塊。
r=0?#紅色
g=0?#綠色
b=0?#藍(lán)色
k=0
c=1
d=0
while(True):
????clock.tick()
#????c?=?uart.readchar()-48?#48是什么?從單片機(jī)傳過來的數(shù)據(jù)?


????#二維碼識別測試
????if?c==2:
????????img?=?sensor.snapshot()
????????img.lens_corr(1.8)?#矯正
????????for?code?in?img.find_qrcodes():
????????????img.draw_rectangle(code.rect())
????????????#img.draw_rectangle(code.rect())
????????????if?code.payload()?==?“123“?:
????????????????uart.write(‘a(chǎn)‘)
????????????????r_led.on()
????????????????c?=?0
????????????if?code.payload()?==?“132“?:
????????????????uart.write(‘b‘)
????????????????r_led.on()
????????????????c?=?0
????????????if?code.payload()?==?“213“?:
????????????????uart.write(‘c‘)
????????????????r_led.on()
????????????????c?=?0
????????????if?code.payload()?==?“231“?:
????????????????uart.write(‘d‘)
????????????????r_led.on()
????????????????c?=?0
????????????if?code.payload()?==?“312“?:
????????????????uart.write(‘e‘)
????????????????r_led.on()
????????????????c?=?0
????????????if?code.payload()?==?“321“?:
????????????????uart.write(‘f‘)
????????????????r_led.on()
????????????????c?=?0
????????????print(code.payload())
????????lcd.display(img)






????i

評論

共有 條評論