title: Opencv works with raspberry pi locally but not thru network
body: <p>I have the basic python program running on my raspberry pi. It works with no issues. But I was trying to log in to the pi thru another computer like SSH and run the same python program it gives me errors like the video isn't working. What am I doing wrong. Do I need to force the RPI to use its monitor to get this work or what? Any suggestions? </p>
  
  <p>I get this error:</p>
  
  <p>Unable to init server: Could not connect: Connection refused</p>
  
  <p>(Video:1363): Gtk-WARNING **: cannot open display:</p>
  
  <p>This is my program:</p>
  
  <pre><code>from picamera.array import PiRGBArray
  from picamera import PiCamera
  import time
  import cv2
  
  # initialize the camera and grab a reference to the raw camera capture
  camera = PiCamera()
  camera.resolution = (640, 480)
  camera.framerate = 32
  rawCapture = PiRGBArray(camera, size=(640, 480))
  
  # allow the camera to warmup
  time.sleep(0.1)
  
  # capture frames from the camera
  for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
      # grab the raw NumPy array representing the image, then initialize the timestamp
      # and occupied/unoccupied text
      image = frame.array 
      # show the frame
      cv2.imshow("Frame", image)
      key = cv2.waitKey(1) &amp; 0xFF 
      # clear the stream in preparation for the next frame
      rawCapture.truncate(0) 
      # if the `q` key was pressed, break from the loop
      if key == ord("q"):
         break
  </code></pre>