title: How to detect game board in image
body: <p>I need to find a go game board and detect chips on the photo with opencv2 on python, but now I have problems with the board detecting, there are strange dots in the same contour and I don't understand, how I can remove them. That's what I have now:</p>
  
  <pre><code>from skimage import exposure
  import numpy as np
  import argparse
  import imutils
  import cv2
  
  ap = argparse.ArgumentParser()
  ap.add_argument("-r", required = True,
      help = "ratio", type=int, default = 800)
  args = vars(ap.parse_args())
  
  img = cv2.imread('3.jpg') #upload image and change resolution
  ratio = img.shape[0] / args["r"]
  orig = img.copy()
  img = imutils.resize(img, height = args["r"])
  
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
  gray = cv2.bilateralFilter(gray, 11, 17, 17)
  edged = cv2.Canny(gray, 30, 200)
  
  cnts= cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) #search contours and sorting them
  cnts = imutils.grab_contours(cnts)
  cnts = sorted(cnts, key = cv2.contourArea, reverse = True)[:10]
  screenCnt = None
  
  for cnt in cnts:
  
      rect = cv2.minAreaRect(cnt) # try to fit each contour in rectangle
      box = cv2.boxPoints(rect)
      box = np.int0(box)
  
      area = int(rect[1][0]*rect[1][1]) # calculating contour area
  
      if (area &gt; 300000):
          print(area)
          cv2.drawContours(img, cnt, -1, (255, 0, 0), 4) #dots in contour
          hull = cv2.convexHull(cnt) # calculating convex hull
          cv2.drawContours(img, [hull], -1, (0, 0, 255), 3)
  
  cv2.imshow("death", img)
  cv2.waitKey(0)
  </code></pre>
  
  <p>Source </p>
  
  <p><img src="https://i.stack.imgur.com/pKUJw.jpg" alt="source image"></p>
  
  <p>Result</p>
  
  <p><img src="https://i.stack.imgur.com/AJQVg.jpg" alt="result image"></p>