赞
踩
还是直接上代码
#NCC的匹配方式
import sensor, image, time,pyb
from image import SEARCH_EX, SEARCH_DS
import ustruct
from pyb import UART
import json
# Reset sensor
sensor.reset()
# Set sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# Max resolution for template matching with SEARCH_EX is QQVGA
sensor.set_framesize(sensor.QQVGA)
# You can set windowing to reduce the search image.
#sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
sensor.set_pixformat(sensor.GRAYSCALE)
# Load template.
# Template should be a small (eg. 32x32 pixels) grayscale image.
template = image.Image("/1.pgm")#自己的图片名
clock = time.clock()
uart = UART(3,115200) #定义串口3变量
uart.init(115200, bits=8, parity=None, stop=1)
# Run template matching
def send_data_packet(x,y,z,w):
temp = ustruct.p
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。