title: OpenCV how to smooth contour, reducing noise
body: <p>I extracted the contours of an image, that you can see here:
  <a href="https://i.stack.imgur.com/mmnUF.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mmnUF.jpg" alt="contour"></a></p>
  
  <p>However, it has some noise.
  How can I smooth the noise? I did a close up to make clearer what I want to meant
  <a href="https://i.stack.imgur.com/qWvGP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qWvGP.png" alt="enter image description here"></a></p>
  
  <p>Original image that I've used:
  <a href="https://i.stack.imgur.com/5evOn.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/5evOn.jpg" alt="enter image description here"></a></p>
  
  <p>Code:</p>
  
  <pre><code>rMaskgray = cv2.imread('redmask.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
  (thresh, binRed) = cv2.threshold(rMaskgray, 50, 255, cv2.THRESH_BINARY)
  
  Rcontours, hier_r = cv2.findContours(binRed,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE)
  r_areas = [cv2.contourArea(c) for c in Rcontours]
  max_rarea = np.max(r_areas)
  CntExternalMask = np.ones(binRed.shape[:2], dtype="uint8") * 255
  
  for c in Rcontours:
      if(( cv2.contourArea(c) &gt; max_rarea * 0.70) and (cv2.contourArea(c)&lt; max_rarea)):
          cv2.drawContours(CntExternalMask,[c],-1,0,1)
  
  cv2.imwrite('contour1.jpg', CntExternalMask)
  </code></pre>