简体   繁体   中英

Show image using OpenCV in Python on a Raspberry Pi terminal

I get a gtk-WARNING when trying:

cv2.imshow("WindowName", image)

I'm using this to watch a live stream one frame at a time. Are there any alternative libraries I could use? I tried several other options like PIL and Tkinter as well as wand, but could get none of them to work for various different reason.

You need to use a windowing system to display images using imshow . (That can be enabled in settings running sudo raspi-config )

If you absolutely, positively need to display images without using a windowing system, consider providing an html/web interface. Two options that come to mind when serving a web interface are:

  1. Creating an HTTP video stream (serve the output image as if it's an IP camera, kind of)
  2. Stream the output matrix as a jpg blob via websockets

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM