Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,216 Views

Intel Edison error :- Gtk-WARNING **: cannot open display:

Jump to solution

Hi,

I installed opencv for Intel edison from http://repo.opkg.net/edison/repo/core2-32/ Alext"s repository.

 

Now I'm trying to capture image from webcam using opencv but it gives the following error:-

Error:-

(frame:2379): Gtk-WARNING **: cannot open display:

My code:-

import numpy as np

import cv2

cap = cv2.VideoCapture(0)

while(True):

# Capture frame-by-frame

ret, frame = cap.read()

# Display the resulting frame

cv2.imshow('frame',frame)

if cv2.waitKey(1) & 0xFF == ord('q'):

break

# When everything done, release the capture

cap.release()

cv2.destroyAllWindows()

how to solve this ?


Accepted Solutions
Carlos_M_Intel
Employee
174 Views

Hi Falak,

The error you are getting could be related with the function of the code you are using. The code seems to capture video and then shows it in a window, you can't do this because there is no video on the Edison. I suggest you to try with this code:

import cv2.cv as cv

capture = cv.CaptureFromCAM(0)

img = cv.QueryFrame(capture)

cv.SaveImage("camera.jpg", img)

Regards,

Charlie

View solution in original post

8 Replies
Carlos_M_Intel
Employee
175 Views

Hi Falak,

The error you are getting could be related with the function of the code you are using. The code seems to capture video and then shows it in a window, you can't do this because there is no video on the Edison. I suggest you to try with this code:

import cv2.cv as cv

capture = cv.CaptureFromCAM(0)

img = cv.QueryFrame(capture)

cv.SaveImage("camera.jpg", img)

Regards,

Charlie

View solution in original post

idata
Community Manager
174 Views

Hi CMata_Intel,

the solution is correct. But what if i want to stream video using OpenCV with Python/C++ on my Intel Edison ?

Carlos_M_Intel
Employee
174 Views

Hi Falak,

I found this code: https://gist.github.com/n3wtron/4624820 Simple Python Motion Jpeg (mjpeg server) from webcam. Using: OpenCV,BaseHTTPServer · GitHub and it worked for me.

1. You need to know which is the IP address of your board, you can check this with configure_edison –showWiFiIP, you should get something like 192.168.10.XX.

[Let's say that your IP address is 192.168.10.10]

2. Then run the code with python

3. Finally go to your web browser and access to 192.168.10.10:8080/cam.mjpg

Regards,

Charlie

idata
Community Manager
174 Views

hi CMata_Intel,

the command you provided also worked for me. It looks like the program works properly.

but it doesn't start my camera. so I can see only "server started" message in terminal.

i cannot see video on the 192.168.1.10:8080/cam.mjpg (192.168.1.10 is my edison ip)

Carlos_M_Intel
Employee
174 Views

Hi Falak,

Is the PC and Board on the same network?

Are you running something else in your board that may be blocking the functionality of the python code?

Regards,

Charlie

idata
Community Manager
174 Views

Hi CMata_Intel,

yes the pc and edison board both are on the same network.

and I'm not running any other program. I'm just running this single script containing this python code.

Carlos_M_Intel
Employee
174 Views

Hi Falak,

Which image version do you have currently? I suggest you to use the 159 version.

Have you changed something in the code?

Are you behind a proxy?

When you type 192.168.1.10:8080/cam.mjpg on your web browser, what are you getting as result?

I know you have installed FFMPEG I your board, what other packages have you installed? I also suggest you to try with a clean image so if you can flash the board and try again with the example let me know.

Regards,

Charlie

YYeon1
Novice
174 Views

Hi CMata_Intel,

I'm facing the same problem. Both PC and board are on same network.

[tcp @ 0x1ca0700] Connection to tcp://192.168.8.101:8080?timeout=0 failed: Connection refused

I am using 120 version. edison-image-ww05-15.

May I know how to check the port number? Is it the same (port 8080) for everyone?

Btw, how to solve the proxy issue?

Thanks

Regards,

Yeong