- 树莓派 3 型号 B
- OpenCV 3.0.0
- 蟒蛇 3.6.x
无法通过 openCV 显示图像。 ex) imshow() 这是我的源代码。
def show_captured_image(path):
img = cv2.imread(path, 1)
resize_img = cv2.resize(img, (480, 320))
xy_axis = cv2.flip(resize_img, -1)
cv2.imshow("img", xy_axis)
cv2.moveWindow("img", 0, 0)
cv2.waitKey(0)
(img:2984): Gtk-WARNING **: cannot open display:
出现在这一行。
请告诉我解决方案!
原文由 Hideki Tsuruoka 发布,翻译遵循 CC BY-SA 4.0 许可协议
尝试在运行脚本之前从您的 ssh 会话中执行
export DISPLAY=":0"
。它应该将您的显示器设置为连接到树莓派的显示器。