My opencv python program displays a seemingly expectant prhrase, but neither terminates, nor allows progress
Question: I am having trouble with a program in which I want to perform a sobel
derivation from openCV to find edges in a picture. I found a python adaptation
of this code: sobel_derivatives.html#sobel-derivatives from the opencv
tutorials on this adress: Official_Tutorial_Python_Codes/3_imgproc/sobel.py
which I wanted to copy and adapt to run on an image I found on the web. after
having done abit of debugging, and running the program as "sudo", I simply get
the message:

init done

opengl support available

and the prgram never terminates. I cannot use ctrl+c, or any other such
commands (I am accessing my ubuntu OS from a puTTy client) my only option to
retry, is to stop and restart my session.

My problem seems rather similar to this one: init-done-opengl-support-
available but I cannot quite seem to work it out, nor am I able to post a
further question on this thread. as far as I can tell, there seems to be an
error in my openCV2. I tried to redownload it with a "sudo apt-get install",
but no change. My code looks like this:

    
    
    """
    Sobel_derivation.py
    
    attempt at finding the derivatives in a picture.
    this is extremely beginner-level coding, so please
    bear with me. Might also take a look at the supposedly
    more accurate 'Scharr' derivatives.
    
    mostly imported and attempted to interpret from
    https://github.com/abidrahmank/OpenCV2-Python/blob/master/Official_Tutorial_Python_Codes/3_imgproc/sobel.py
    """
    
    import cv2 # this is the currently installed version of openCV
    import numpy as np # useful tool for most array-based computing
    
    scale = 1 # for scaling the derivatives in the x and y direction
    delta = 0 # optional value, here apparently set as trivial (also, mostly
    #important for the 'Scharr' function from what I can see.
    #ddepth = cv2.CV_16u # output image depth for 'scharr' function
    ddepth = -1 #this should give the return image equal depth
    
    img = cv2.imread('splash.jpg') # importing the image to be read from
    # this directory, for simplicity
    
    img = cv2.GaussianBlur(img, (3,3),0) # calling the function from cv. img
    # is the previous image and (3,3) seems to be the size. the point of
    # the function is to smooth the image to reduce noise.
    
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)# the function returns a
    # colour gray, greyscale of the image.
    
    
    # time for the gradient in the x-direction
    grad_x = cv2.Sobel(gray, ddepth, 1,0, ksize=3, scale=scale, delta=delta, borderType=cv2.BORDER_DEFAULT)
    # grad_x = cv2.Scharr(gray,ddepth, 1,0)
    #now for y
    grad_y = cv2.Sobel(gray, ddepth, 0,1, ksize=3, scale=scale, delta=delta, borderType=cv2.BORDER_DEFAULT)
    # grad_y = cv2.Scharr(gray, ddepth, 0, 1)
    
    abs_grad_x = cv2.convertScaleAbs(grad_x) #converting back to uint8
    abs_grad_y = cv2.convertScaleAbs(grad_y)
    
    dst = cv2.addWeighted(abs_grad_x, 0.5, abs_grad_y, (0.5), 0)
    #dst = cv2.add(abs_grad_x. abs_grad_y)
    
    cv2.imshow('dst', dst)
    cv2.waitKey(0)
    cv2.DestroyAllWindows()
    


Answer: You have to enable X11 forwarding in order to open windows from a remote host
to your local machine. If you use putty go to Putty Configuration > Connection
> X11 and check enable X11 forwarding.

![enter image description here](http://i.stack.imgur.com/gEddY.png)

If you are connecting trough ssh simply add -X flag to you command e.g. `ssh
-X username@remote-host.com`

The cryptic output

    
    
    init done
    opengl support available
    

was left there (minor bug I guess) by the developers and is printed anytime
cv::imshow(..) is executed in a program.

