title: Detect star shape in opencv-python
body: <p>I need to detect the shapes and count the occurence of each shape in the image.I initially detected the contours and approximated them ,and counted the vertices in each of the contour present.My code looks like this:</p>
  
  <pre><code>import cv2
  import numpy as np 
  import collections
  import sys
  
  img = cv2.imread(str(sys.argv[1]),0)
  ret,thresh = cv2.threshold(img,127,255,0)
  contours,hierarchy = cv2.findContours(thresh,1,2)
  
  
  no_of_vertices = []
  
  i = 0
  mask = np.zeros(img.shape,np.uint8)
  for contour in contours:
  
   cnt = contour
   area = cv2.contourArea(cnt)
   if area&gt;150:
      epsilon = 0.02*cv2.arcLength(cnt,True)
      approx = cv2.approxPolyDP(cnt,epsilon,True)
      no_of_vertices.append(len(approx))
  
  
  
  counter = collections.Counter(no_of_vertices)
  
  
  
  
   a,b = counter.keys(),counter.values()
  
   i=0
   while i&lt;len(counter):
     print a[i],b[i]
     i = i + 1
  </code></pre>
  
  <p>My code doesnt work for detecting the stars in this image:</p>
  
  <p><a href="https://i.stack.imgur.com/nRomG.png"><img src="https://i.stack.imgur.com/nRomG.png" alt="Image with stars and other basic shapes"></a></p>
  
  <p>What changes should I make in the code?</p>