title: OpenCV findContours only finds the border of the image
body: <p>I'm working on a project to track a laser and a photodiode with a camera attached to a raspberry pi. The pi will send instructions to an arduino, which will reorient the laser until I get a response from the photodiode. Right now, I'm working on the camera aspect of the process. </p>
  
  <p>I'm trying to find the contours of my image so that I can match them with the general contours of the objects I'll be using, but my findContours() only gives me the border of my image. </p>
  
  <p>I wish I could post the images, but I don't have enough rep. The Canny Edge is black and white, white lines with a black background. The image with the contours on it is the captured image but with a drawn border and no other contours.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>def DED(grayImg):                           #Edge Detection, returns image array
  
      minInt, maxInt, minLoc, maxLoc = cv2.minMaxLoc(grayImg) #Grayscale: MinIntensity, Max, and locations
      beam = cv2.mean(grayImg)    #Find the mean intensity in the img pls.
      mean = float(beam[0])
      CannyOfTuna = cv2.Canny(grayImg, (mean + minInt)/2, (mean + maxInt)/2)  #Finds edges using thresholding and the Canny Edge process.
  
      return CannyOfTuna
  
  
  def con2z(Gray, ogImage):                           #Find contours from = Canny Edge Image, draw onto original
      lines, pyramids = cv2.findContours(Gray, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
  
  
      gimmeGimme = cv2.drawContours(ogImage, lines, -1, (128,255,0), 3)       #draw contours on 
                  #The -1 signifies ALL contours will be drawn.
  
      return lines
  
  with picamera.PiCamera() as camera:
      camera.resolution = (640,480)
      out = camera.capture('output.jpg')                  # Camera start
      output = cv2.imread('output.jpg')
  
      grayput = cv2.cvtColor(output, cv2.COLOR_BGR2GRAY)      #Grayscale
      cv2.imwrite('gray.jpg', grayput)
  
      cans = DED(grayput)                                     #Canny Edge
      cv2.imwrite('Canny.jpg', cans)
  
  
      lines = con2z(grayput, output)                      # Contours please
  
      print(lines)
      cv2.imwrite('contours.jpg', output)
  </code></pre>
  
  <p>EDIT: Here are the two photos
  <a href="http://imgur.com/EVeMVdm,QLoYa2o#0" rel="nofollow">http://imgur.com/EVeMVdm,QLoYa2o#0</a>
  <a href="http://imgur.com/EVeMVdm,QLoYa2o#1" rel="nofollow">http://imgur.com/EVeMVdm,QLoYa2o#1</a></p>