Opencv填充坐标区域

import cv2
import numpy as np


out_path = './768576.jpg'
kuan, gao = 768, 576
img = np.zeros([gao, kuan, 3])  # 创建一个576行768列的三位数组
points = np.array([[175, 113], [248, 47], [662, 47], [736, 114], [736, 460], [662, 527], [248, 527], [175, 460]], np.int32)

img = cv2.polylines(img, [points], isClosed=True, color=[0, 0, 0], thickness=0)
img = cv2.fillPoly(img, [points], color=[255, 255, 255])

cv2.imwrite(out_path, img) # 保存图片

你可能感兴趣的:(python,numpy,深度学习,人工智能,opencv)