title: Using findContours in Python with OpenCV
body: <p>I'm using OpenCV on the raspberry pi and building with Python.  Trying to make a simple object tracker that uses color to find the object by thresholding the image and finding the contours to locate the centroid.  When I use the following code:</p>
  
  <pre><code>image=frame.array
  imgThresholded=cv2.inRange(image,lower,upper)    
  _,contours,_=cv2.findContours(imgThresholded,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
  cnt=contours[0]
  Moments = cv2.moments(cnt)
  Area = cv2.contourArea(cnt)
  </code></pre>
  
  <p>I get the following error.</p>
  
  <pre><code>Traceback (most recent call last):
   File "realtime.py", line 122, in &lt;module&gt;
    cnt=contours[0]
  IndexError: list index out of range
  </code></pre>
  
  <p>I've tried a few other settings and get the same error or</p>
  
  <pre><code>ValueError: too many values to unpack
  </code></pre>
  
  <p>I'm using the PiCamera.  Any suggestions for getting centroid position?</p>
  
  <p>Thanks</p>
  
  <p>Z</p>