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

  • 大小: 0M
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-06
  • 語言: 其他
  • 標簽: 其他??

資源簡介

main.zip

資源截圖

代碼片段和文件信息

‘‘‘
有用的視覺算法都試一試
‘‘‘
import?sensor?image?time
from?pyb?import?LED
from?pyb?import?Pin
from?pyb?import?UART
import?sys

#######外設初始化區#######
uart?=?UART(3?115200)
uart.init(115200?bits=8?parity=None?stop=1)??#?串口初始化
pin3?=?Pin(‘P3‘?Pin.IN?Pin.PULL_UP)???????????#?P3作為IO口,低電平作為開始讀色環的依據
pin6?=?Pin(‘P6‘Pin.INPin.PULL_DOWN)???????????#?P6串口發送給單片機
led_green?=?LED(1)??????????????????????????????#?綠燈
led_blue?=?LED(2)???????????????????????????????#?藍燈

#######攝像頭初始化區#######
sensor.reset()
sensor.set_pixformat(sensor.RGB565)?????????????#?彩色
sensor.set_framesize(sensor.QVGA)?????????????????#?分辨率
sensor.skip_frames(time?=?600)
sensor.set_auto_whitebal(False)
sensor.set_auto_gain(False)#?白平衡值恒為(-5-6-4)
clock?=?time.clock()????????????????????????????#?系統時鐘

#######曝光值定義區#######
expo_circle=2000????????????#?色環曝光值?暗一點有利于識別
#######標志位變量定義區#######
i?=?1???????????????????????#?全局,控制階段數012追蹤顏色?3發送顏色順序?4二維碼識別與發送?5無?6色環
circles?=?0?????????????????#?色環階段,第幾個圓圈
red_timesgreen_timesblue_times?=?000?#色環階段,記錄紅綠藍的次數
level?=?0???????????????????#?色環階段是高電平還是低電平
#######順序變量定義區#######
circle_order?=?0????????????#?色環顏色的順序
#######大小變量定義區#######
blob_size?=?300?????????????#?尋找色塊的最小值?find_blobs?函數的?pixel_threshold?和?area_threshold
pixel_size?=?10???????????????????#?尋找色環的最小像素單位

#######函數定義區#######
#?發送物塊的顏色順序,用小寫abcdef來表示順序
def?send_blob(blob_order):
????if?blob_order?==?1230:
????????uart.write(“a“)?????????#?當順序是紅綠藍,發送字母a
????????print(‘a‘)
????if?blob_order?==?1320:
????????uart.write(“b“)
????????print(‘b‘)
????if?blob_order?==?2130:
????????uart.write(“c“)
????????print(‘c‘)
????if?blob_order?==?2310:
????????uart.write(“d“)
????????print(‘d‘)
????if?blob_order?==?3120:
????????uart.write(“e“)
????????print(‘e‘)
????if?blob_order?==?3210:
????????uart.write(“f“)
????????print(‘f‘)
#?發送二維碼的順序值,用大寫ABCDEF表示順序
def?send_code(code_order):
????if?code_order?==?123:
????????uart.write(“A“)
????if?code_order?==?132:
????????uart.write(“B“)
????if?code_order?==?213:
????????uart.write(“C“)
????if?code_order?==?231:
????????uart.write(“D“)
????if?code_order?==?312:
????????uart.write(“E“)
????if?code_order?==?321:
????????uart.write(“F“)
#亮燈函數
def?cyan_on():
????led_green.on()
????led_blue.on()
def?green_on():
????led_green.on()
????led_blue.off()
def?blue_on():
????led_green.off()
????led_blue.on()
def?off():
????led_green.off()
????led_blue.off()


red_threshold?=?[20?28?36?44?11?29]
red_threshold_dim?=?[11?20?25?35?4?21]
red_threshold_bright?=?[9?19?21?33?1?21]

green_threshold?=?[40?53?-49?-41?27?41]
green_threshold_dim?=?[21?30?-35?-25?18?33]
green_threshold_bright?=[14?29?-30?-16?8?27]

blue_threshold?=?[6?15?-7?10?-27?-8]
blue_threshold_dim?=?[12?23?8?24?-49?-32]
blue_threshold_bright?=?[12?21?-7?11?-32?-12]

red_color_code?=?1?#?code?=?2^0?=?1
green_color_code?=?2?#?code?=?2^1?=?2
blue_color_code=4?#code=

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????15185??2019-05-18?15:38??main.py

評論

共有 條評論