I am using RASPBIAN STRETCH LITE on Raspberry Pie 3. I have connected it to a monitor and written a python code which subscribes to a mqtt
Message. The functionality is, it receives message in form of string which is a url of the image. It is supposed to display image on the monitor. The python code is:
from PIL import Image
import urllib
import io
import cv2
import numpy as np
URL= "http://www.w3schools.com/css/trolltunga.jpg"
stream = urllib.urlopen(URL).read()
image = np.asarray(bytearray(stream),dtype="uint8")
image = cv2.imdecode(image,cv2.IMREAD_COLOR)
cv2.imshow("Image",image)
cv2.waitKey(0)
But the image is not displayed and I get warning message gtk-warning ** cannot open display
.
Please let me know how it should work.
It works with
import os
os.system("sudo killall fbi")
os.system("sudo fbi -T 1 image1.jpg")