1.物体识别 本案例实现对特殊颜色物体的识别,并实现根据物体位置的改变进行控制跟随。 import cv2 as cv # 定义结构元素 kernel = cv.getStructuringElement(cv.MORPH_RECT, (3, 3)) # print kernel capture = cv.VideoCapture(0) print capture.isOpened() ok, frame = capture.read() lower_b = (65, 43, 46) upper_b = (110, 255, 255) height, width = frame.shape