第1步:获取到桌球台的图像信息
需要获取桌面固定区域的实时图像(这里为了方便,直接截取了一张图片)
第2步:识别出球杆和白球
创建滑条from cv2 import cv2
import numpy as np
def empty(a):
pass
cv2.namedWindow("TarckBars")
cv2.resizeWindow("TarckBars",640,240)
cv2.createTrackbar("Hue Min", "TarckBars", 0, 180, empty)
cv2.createTrackbar("Hue Max", "TarckBars", 180, 180, empty)
cv2.createTrackbar("Sat Min", "TarckBars", 0, 255, empty)
cv2.createTrackbar("Sat Max", "TarckBars", 255, 255, empty)
cv2.createTrackbar("Lig Min", "TarckBars", 0, 255, empty)
cv2.createTrackbar("Lig Max", "TarckBars", 255, 255, empty)
导入我们的图片img = cv2.i