标签:wait flip python horizon random pre key div box
水平翻转(标注翻转): def random_horizontal_flip(image, bboxes): _, w, _ = image.shape # [::-1] 顺序相反操作 # a = [1, 2, 3, 4, 5] # a[::-1] # Out[3]: [5, 4, 3, 2, 1] image = image[:, ::-1, :] bboxes[:, [0, 2]] = w - bboxes[:, [2, 0]] return image, bboxes bbox = np.array([[185,62,279,199,14]]) image = np.array(cv2.imread("000001.jpg")) image1, bboxes = random_horizontal_flip(image.copy(), bbox.copy()) cv2.namedWindow(‘0‘,0) cv2.imshow(‘0‘,image1) cv2.waitKey(0)
标签:wait flip python horizon random pre key div box
原文地址:https://www.cnblogs.com/lzq116/p/12167099.html