title: How to use python and OpenCV to mark license plates in image
body: <p>I am trying to use a python script with OpenCV to pick out license plates in a image and return the coordinates/draw a bounding box around the license plate. My script that I wrote is not able to find the license plate, it often returns a different area of the car.</p>
  
  <pre><code>import numpy as np
  import cv2
  
  def find_license(image):
      gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
      gray = cv2.bilateralFilter(gray, 11, 17, 17)
      edged = cv2.Canny(gray, 30, 200)
  
      cv2.imwrite('detect.png', edged) 
      (cnts, _) = cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
      cnts=sorted(cnts, key = cv2.contourArea, reverse = True)[:20]
  
      # loop over our contours
      for c in cnts:
          peri = cv2.arcLength(c, True)
          approx = cv2.approxPolyDP(c, 0.02 * peri, True)
          cv2.drawContours(image, [approx], -1, (0,255,0), 3)
  
      # compute the bounding box of the of the paper region and return it
      return cv2.minAreaRect(c)
  </code></pre>