在已识别的多边形周围的 opencv 中绘制轮廓

Draw Contours in opencv around recognized polygon

我正在研究 OpenCV-Python。 我有一个这样的图像(下面的图像,但没有浅绿色线条)来自 webcam.I 的实时提要已经找到角坐标,

(array([[[280, 109]],

   [[162, 206]],

   [[189, 341]],

   [[329, 389]],

   [[444, 283]],

   [[412, 160]]])

的多边形。 如何在已识别的多边形周围画一条线,就像图像上显示的浅绿色线一样?

Recognized shape

您可以使用drawContours()函数:

cv2.drawContours(img, contours, -1, (0,255,0), 3)

文档解释得很好:

http://docs.opencv.org/master/d4/d73/tutorial_py_contours_begin.html#gsc.tab=0