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

資源簡介

openmv尋線,把攝像頭當成8路光電數字灰度進行尋線,同時可識別十字路線,已配置uart3輸出需要的數據

資源截圖

代碼片段和文件信息

#?Hello?World?Example
#
#?Welcome?to?the?OpenMV?IDE!?Click?on?the?green?run?arrow?button?below?to?run?the?script!

import?pyb?sensor?image?math?time
from?pyb?import?UART
import?json
uart?=?UART(3115200)
GRAYSCALE_THRESHOLD?=?[(0?50)]
led?=?pyb.LED(3)
usb?=?pyb.USB_VCP()
led.on()

roi_1?=?[(20?0?120?20)?????????#??北
????????????(20?100?120?20)?????#?南
????????????(0?0?20?120)????????#??西
????????????(140?0?20?120)??????#??東
????????????(60404040)]??????????#???中

sensor.reset()?#?初始化攝像頭
sensor.set_pixformat(sensor.GRAYSCALE)?#?格式為?RGB565.
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(20)?#?跳過10幀,使新設置生效
sensor.set_auto_whitebal(False)?#?turn?this?off.
sensor.set_auto_gain(False)?#?must?be?turned?off?for?color?tracking
clock?=?time.clock()
low_threshold?=?(0?40?????????????????????????)

buf?=[0?for?i?in?range(5)]

DI?=[0?for?i?in?range(8)]
DI1?=[0?for?i?in?range(8)]
uart.init(115200?bits=8?parity=None?stop=1)


while(True):
????????m?=?-1
????????isten?=?0
????????#img?=?sensor.snapshot()
????????img?=?sensor.snapshot().lens_corr(strength?=?1.8?zoom?=?1.0)

????????img.binary([low_threshold]invert?=?1)
????????for?r?in?roi_1:
????????????m?+=?1
????????????blobs?=?img.find_blobs(GRAYSCALE_THRESHOLD?roi=r[0:4]pixels_threshold=100?area_threshold=100?merge=True)
????????????#img.draw_rectangle(r[0:4]?color=(25500))
????????????if?blobs:
????????????????most_pixels?=?0
????????????????largest_blob?=?0
????????????????for?i?in?range(len(blobs)):
????????????????#目標區域找到的顏色塊(線段塊)可能不止一個,找到最大的一個,作為本區域內的目標直線
????????????????????if?blobs[i].pixels()?>?most_pixels:
????????????????????????most_pixels?=?blobs[i].pixels()
????????????????????????#merged_blobs[i][4]是這個顏色塊的像素總數,如果此顏色塊像素總數大于
????????????????????????largest_blob?=?i
????????????????#?Draw?a?rect?around?the?blob.
????????????????img.draw_rectangle(blobs[largest_blob].rect())
????????????????#將此區域的像素數最大的顏色塊畫矩形和十字形標記出來

評論

共有 條評論