title: OpenCV Python: Closed Contour Approximation For A Speech Bubble Shape
body: <p>I've got a shape like a speech bubble. And I only want to detect the ellipse of this shape like in the image with the green encircled one.</p>
  
  <p><a href="https://i.stack.imgur.com/s4muQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s4muQ.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/7gV1T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7gV1T.png" alt="enter image description here"></a></p>
  
  <p>I tried with closed morphology, but certain parts of the bubbles are also removed. I used a Kernel with a matrix of 20, 20. The shape becomes more rectangular. Maybe I have to change the kernel matrix more like this:</p>
  
  <pre><code>0 1 0
  1 1 1
  0 1 0
  </code></pre>
  
  <p>I also tried to draw a convex hull, but it also has no effect. And a inner convex hull is not possible. Here is my code for drawing a convex hull:</p>
  
  <pre><code>for i in range (max_index):
      hull = cv2.convexHull(contours[i])
      cv2.drawContours(image, [hull], 0, (0, 255, 0), 2)
  </code></pre>
  
  <p>I retrieved the contours with the parameters <code>cv2.RETR_EXTERNAL</code> and <code>cv2.CHAIN_APPROX_NONE</code></p>