Draw Contours in opencv around recognized polygon

Go To StackoverFlow.com

0

I am working on OpenCV-Python. I have a image like this(bellow image,but without light green lines) from live feed by webcam.I have found corners coordinates,

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

   [[162, 206]],

   [[189, 341]],

   [[329, 389]],

   [[444, 283]],

   [[412, 160]]])

of polygon. How to draw a line around recognized polygon like light green lines shown on image?

Recognized shape

2016-01-23 08:32
by user_fs10


1

You can use drawContours() function:

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

The documentation explains it well:

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

2016-01-23 08:41
by Mahm00d
Result is like this,It can't draw lines. https://drive.google.com/file/d/0B53F0wBGnYhdTFN1U0tQQzM3QTg/view?usp=sharing

What can I do for this - user_fs10 2016-01-23 12:20

I found a solution,I think It's my fault,

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

This is working properly.Thanks @Mahm00 - user_fs10 2016-01-23 13:16

@NSiri glad it worked - Mahm00d 2016-01-23 15:39