在锡月平台上移植好的源程序
# -*- coding:utf-8 -*-
# 创建时间:2019年8月8日
# 功能:模式一:二维码/条形码识别+拐点圆柱识别
# 模式二:靶子识别定位
import numpy as np
import imutils
import time
import cv2
import V_Display as vd
import V_UCom as com
import pyzbar.pyzbar as pyzbar
# 模式一发送数据
Uart_buf1 = [0x55, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xAA]
# 模式三发送数据
Uart_buf3 = [0x55, 0xAA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xAA]
# 切换两种模式的标志位
global flag
flag = 0 # 默认模式一
# 二维码识别函数
# 输入参数:读取图像矩阵
# 返回参数:image标记后的图像矩阵;C_x,C_y:目标二维码中心点坐标;
# (返回参数:flag:等于1时表示成功检测到二维码,0表示未成功检测)
def decodeDisplay(image):
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # 转换成灰度图
barcodes = pyzbar.decode(image)
# print('barcodes', barcodes)
if barcod