久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2707|回復(fù): 1
收起左側(cè)

工程訓練賽 用openmv識別二維碼與顏色

[復(fù)制鏈接]
ID:524458 發(fā)表于 2019-10-21 18:15 | 顯示全部樓層 |閱讀模式
import sensor, image, time,json
from pyb import UART

i= 1
# 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 = [(7, 41, 13, 37, -63, -21), #yellow generic_red_thresholds -> index is 0 so code == (1 << 0)
              (55, 79, -39, 0, 8, 27),
              (35, 55, 21, 84, 26, 69)] #blue generic_green_thresholds -> index is 1 so code == (1 << 1)
# 當“find_blobs”的“merge = True”時,code代碼被組合在一起。

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()

# 只有比“pixel_threshold”多的像素和多于“area_threshold”的區(qū)域才被
# 下面的“find_blobs”返回。 如果更改相機分辨率,
# 請更改“pixels_threshold”和“area_threshold”。 “merge = True”合并圖像中所有重疊的色塊。
uart =UART(3,115200)

while(True):
    clock.tick()
    img = sensor.snapshot()
    if i==1:
         img.lens_corr(1.8) # strength of 1.8 is good for the 2.8mm lens.
         for code in img.find_qrcodes():
            print(code)
            output_str="{%d}" code
            uart.write(output_str+'\r\n')
            print('send:',output_str)
            i=1
    else:
        for blob in img.find_blobs(thresholds,pixels_threshold =50):
            if blob.code() == 1: # r/g code == (1 << 1) | (1 << 0)
                img.draw_rectangle(blob.rect())
                img.draw_cross(blob.cx(), blob.cy())
                output_str="{1}"
                uart.write(output_str+'\r\n')
                print('send:',output_str)
            if blob.code() == 2: # r/g code == (1 << 1) | (1 << 0)
                img.draw_rectangle(blob.rect())
                img.draw_cross(blob.cx(), blob.cy())
                output_str="{2}"
                uart.write(output_str+'\r\n')
                print('send:',output_str)
                #print(2)
            if blob.code() == 4: # r/g code == (1 << 1) | (1 << 0)
                img.draw_rectangle(blob.rect())
                img.draw_cross(blob.cx(), blob.cy())
                output_str="{3}"
                uart.write(output_str+'\r\n')
                print('send:',output_str)
                #print(3)

回復(fù)

使用道具 舉報

ID:649415 發(fā)表于 2020-12-20 17:00 | 顯示全部樓層
復(fù)制到open mv的IDE中為什么會有錯誤呢
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復(fù) 返回頂部 返回列表
主站蜘蛛池模板: 性色av一区二区三区 | 国产一级片在线观看视频 | 国产伦精品一区二区三区高清 | 亚洲精品国产电影 | 亚洲精品1| 午夜电影网 | 久久丝袜| 黄色电影在线免费观看 | 欧美一区二区三区视频 | 久久免费精品 | 免费网站在线 | 日本韩国欧美在线观看 | 国产精品久久久久影院色老大 | 欧美在线视频一区二区 | 91亚洲国产成人久久精品网站 | 午夜影院在线观看免费 | 97精品一区二区 | 精品国产欧美 | 国产在线一区二区三区 | 日韩亚洲一区二区 | 欧美色综合网 | 一区二区精品在线 | 国产99视频精品免费播放照片 | 天天操操 | 一区二区国产在线观看 | 天堂亚洲网 | 九九视频在线观看 | av在线播放国产 | 亚洲a毛片 | 极品电影院 | 成人av电影在线观看 | 国产一区二区三区四区五区3d | 日本在线免费看最新的电影 | 超碰av在线 | 久久久久亚洲精品国产 | 日韩精品在线一区 | av中文字幕在线播放 | 国内自拍真实伦在线观看 | 国产美女一区二区 | 成人免费视频一区二区 | 欧美精品一区二区三区在线播放 |