title: OpenCV - visualize polygonal curve(s) extracted with cv2.approxPolyDP()
body: <p>I want to visualize polygonal curve(s) extracted with <code>cv2.approxPolyDP()</code>. Here's the image I am using:</p>
  
  <p><a href="https://i.stack.imgur.com/k8PVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/k8PVG.png" alt="map of UK"></a></p>
  
  <p>My code attempts to isolate the main island and define and plot the contour approximation and contour hull. I have plotted the contour found in green, the approximation in red:</p>
  
  <pre><code>import numpy as np
  import cv2
  
  # load image and shrink - it's massive
  img = cv2.imread('../data/UK.png')
  img = cv2.resize(img, None,fx=0.25, fy=0.25, interpolation = cv2.INTER_CUBIC)
  
  # get a blank canvas for drawing contour on and convert img to grayscale
  canvas = np.zeros(img.shape, np.uint8)
  img2gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
  
  # filter out small lines between counties
  kernel = np.ones((5,5),np.float32)/25
  img2gray = cv2.filter2D(img2gray,-1,kernel)
  
  # threshold the image and extract contours
  ret,thresh = cv2.threshold(img2gray,250,255,cv2.THRESH_BINARY_INV)
  im2,contours,hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
  
  
  # find the main island (biggest area)
  cnt = contours[0]
  max_area = cv2.contourArea(cnt)
  
  for cont in contours:
      if cv2.contourArea(cont) &gt; max_area:
          cnt = cont
          max_area = cv2.contourArea(cont)
  
  # define main island contour approx. and hull
  perimeter = cv2.arcLength(cnt,True)
  epsilon = 0.01*cv2.arcLength(cnt,True)
  approx = cv2.approxPolyDP(cnt,epsilon,True)
  
  hull = cv2.convexHull(cnt)
  
  # cv2.isContourConvex(cnt)
  
  cv2.drawContours(canvas, cnt, -1, (0, 255, 0), 3)
  cv2.drawContours(canvas, approx, -1, (0, 0, 255), 3)
  ## cv2.drawContours(canvas, hull, -1, (0, 0, 255), 3) # only displays a few points as well.
  
  cv2.imshow("Contour", canvas)
  k = cv2.waitKey(0)
  
  if k == 27:         # wait for ESC key to exit
      cv2.destroyAllWindows()
  </code></pre>
  
  <p>Here are the resulting images:</p>
  
  <p><a href="https://i.stack.imgur.com/b0RQd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b0RQd.png" alt="enter image description here"></a></p>
  
  <p>The first image plots the contour in green. The second plots the approximation in red - how do I plot this approximation as a continuous closed curve?</p>
  
  <p>The <a href="http://docs.opencv.org/3.0-beta/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html#approxpolydp" rel="noreferrer">documentation</a> isn't terribly clear and neither is the <a href="http://docs.opencv.org/3.2.0/dd/d49/tutorial_py_contour_features.html" rel="noreferrer">tutorial</a>, but my understanding is that <code>cv2.approxPolyDP()</code> should define a continuous, closed curve, which I should be able to plot with <code>cv2.drawContours()</code>. Is that correct? If so, what am I doing wrong?</p>