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

資源簡介

國賽運行最終程序

資源截圖

代碼片段和文件信息

#?Untitled?-?By:?hp?-?周日?2月?17?2019
#?open?mv主代碼
#?必須先掃描二維碼,再識別顏色,返回抓取順序
#?uart?通訊
import?sensor?image?time?pyb
ROI?=?(20?120?280?100)

red_threshold?=?(47?68?55?103?25?63)?#?red_thresholds
green_threshold??=?(45?65?-50?-30?0?40)#?green_thresholds
blue_threshold??=?(28?81?-52?81?-29?-87)#?blue_thresholds

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

red_led?=?pyb.LED(1)
green_led?=?pyb.LED(2)
blue_led?=?pyb.LED(3)

uart?=?pyb.UART(39600)
uart.init(9600?bits=8?parity=0?stop=2?timeout_char?=?500)
clock?=?time.clock()

qrcode1=0
RGB_Order=[‘0‘‘0‘‘0‘]?#物塊的排列順序
qr_code=[‘0‘‘0‘‘0‘]?#二維碼要求抓取的順序默認為RGB
sehuan_order=[‘0‘‘0‘‘0‘]#色環順序
Put_Order=0

r=0
g=0
b=0

flag=0
i=j=0

first_one=0
second_one=0
third_one=0


flag_w=1

first_one1=0
second_one1=0
third_one1=0

flag_find_r=0
flag_find_g=0
flag_find_b=0

flag_sehuan_r=0
flag_sehuan_g=0
flag_sehuan_b=0

order=2?#尋找色塊的順序
sehuan=0#色環順序
time.sleep(500)
while?(flag_w==1):
????????????img?=?sensor.snapshot().lens_corr(1.8)
????????????for?blob?in?img.find_blobs([red_threshold]?pixels_threshold=800?area_threshold=800):
????????????????if?flag_find_r==0:
????????????????????img.draw_rectangle(blob.rect())
????????????????????img.draw_cross(blob.cx()?blob.cy())
????????????????????#r=blob.cx()
????????????????????RGB_Order[order]=‘R‘
????????????????????order=order-1
????????????????????flag_find_r=1
????????????????????red_led.on()
????????????????????green_led.off()
????????????????????blue_led.off()
????????????????else:
????????????????????#pass
????????????????????print(“i?have?already?find?the?r“)
????????????#print(“1111111111111“);
????????????#print(r);
????????????for?blob?in?img.find_blobs([green_threshold]?pixels_threshold=200?area_threshold=200):
????????????????if?flag_find_g==0:
????????????????????img.draw_rectangle(blob.rect())
????????????????????img.draw_cross(blob.cx()?blob.cy())
????????????????????#g=blob.cx()
????????????????????RGB_Order[order]=‘G‘
????????????????????order=order-1
????????????????????flag_find_g=1
????????????????????red_led.off()
????????????????????green_led.on()
????????????????????blue_led.off()
????????????????else:
????????????????????#pass
????????????????????print(“i?have?already?find?the?g“)
????????????#print(“222222222222()“);

????????????#print(g);
????????????for?blob?in?img.find_blobs([blue_threshold]?pixels_threshold=200?area_threshold=200):
????????????????if?flag_find_b==0:
????????????????????img.draw_rectangle(blob.rect())
????????????????????img.draw_cross(blob.cx()?blob.cy())
????????????????????#b=blob.cx()
????????????????????RGB_Order[order]=‘B‘
????????????????????order=order-1
????????????????????f

評論

共有 條評論