2

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.

1 Answer 1

2

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
Sign up to request clarification or add additional context in comments.

2 Comments

Do you have any idea if it's possible with another library that doesn't require a window? I know images can be displayed with tools like FBI or stream a camera in Python from PiCamera.
That's a good point actually. I'm not an expert on this, but I have a hunch fbi and the PiCamera preview write straight to the video chip's buffer. If fbi has a library, or there's a similar python library capable of displaying straight to the GPU, you should try that. (In short: 1. find a library that allows you display an image via GPU in Python (without windowing). 2. convert the opencv/numpy pixel array to the image format this library expects, then pass your data to it). Be aware, this would be visible with on a screen (but not using ssh)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.