title: Python opencv drawContours does not show anything
body: <p>I followed the tutorial at <a href="http://opencvpython.blogspot.ca/2012/06/hi-this-article-is-tutorial-which-try.html" rel="noreferrer">this page</a> but nothing seems to happen when the line <code>cv2.drawContours(im,contours,-1,(0,255,0),3)</code> is executed. I was expecting to see star.jpg with a green outline, as shown in the tutorial. Here is my code:</p>
  
  <pre><code>import numpy as np
  import cv2
  
  im = cv2.imread('C:\Temp\ip\star.jpg')
  print im.shape #check if the image is loaded correctly
  imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
  ret,thresh = cv2.threshold(imgray,127,255,0)
  contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
  cv2.drawContours(im,contours,-1,(0,255,0),3)
  pass
  </code></pre>
  
  <p>There are no error messages. star.jpg is the star from the above mentioned webpage. 
  I am using opencv version 2.4.8 and Python 2.7. </p>
  
  <p>Is drawContours supposed to show an image on my screen? If so, what did I do wrong? If not, how do I show the image?</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>Adding the following lines will show the image:</p>
  
  <pre><code>cv2.imshow("window title", im)
  cv2.waitKey()
  </code></pre>
  
  <p>waitKey() is needed otherwise the window will just show a gray background. According to <a href="https://stackoverflow.com/questions/8894451/opencv-shows-gray-image">this post</a>, that's because waitKey() tells it to start handling the WM_PAINT event.</p>