title: Finding contours from a thresholded image
body: <p>I'm currently reading through the example code on the OpenCV website tyring to find contours in an image.</p>
  
  <p>I first read an image and convert to gray-scale:</p>
  
  <pre><code>img = cv2.imread('/.../.../four.png')
  imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  </code></pre>
  
  <p>I then convert the image into binary by applying a threshold:</p>
  
  <pre><code>thresh = cv2.threshold(imgray, 127, 255, 0, cv2.THRESH_BINARY)
  </code></pre>
  
  <p>According to the tutorials.. I should then be able to call <code>findContours()</code> on the thresholded image: </p>
  
  <pre><code>contours = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
  </code></pre>
  
  <p>When trying to execute this code, for some reason i'm getting a type error: </p>
  
  <blockquote>
    <p>contours =
    cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
    <strong>TypeError: image is not a numerical tuple</strong></p>
  </blockquote>
  
  <p>Unsure why? </p>
  
  <p>Here's the full code for easier readability: </p>
  
  <pre><code>img = cv2.imread('/Users/samtozer/Desktop/four.png')
  imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  thresh = cv2.threshold(imgray, 127, 255, 0, cv2.THRESH_BINARY)
  contours = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
  
  cv2.drawContours(img, contours, -1, (0,255,0), 3)
  </code></pre>
  
  <p>Wondering if anyone has experienced this problem before? And if so, what is going wrong xD </p>
  
  <p>Thanks in advance </p>