Coder Social home page Coder Social logo

Add GUI support (Qt) about opencv-python HOT 22 CLOSED

opencv avatar opencv commented on August 19, 2024 7
Add GUI support (Qt)

from opencv-python.

Comments (22)

cachitas avatar cachitas commented on August 19, 2024 15

Just to be more specific, I've encountered this problem when using cv2.imshow() and cv2.waitKey().

from opencv-python.

huan avatar huan commented on August 19, 2024 10

I suggest we consider to publish an OpenCV python module with Gtk/Qt support.

Today I spent serval hours on building OpenCV from scratch in order to use cv2.imshow(), it's very painful.

If add new dependency is a problem, how about publishing a new module with Gtk/Qt support, like opencv-python-gtk and opencv-python-qt ?

from opencv-python.

skvark avatar skvark commented on August 19, 2024 8

You can fork the repo and try to tune the build scripts. First you should try to install GTK+ 2.x to the CentOS container (yum install gtk2 might be enough) and after that make OpenCV build scripts to find it. After that write some test scripts which utilize for example cv2.imshow() to confirm that the build was ok.

from opencv-python.

Greendogo avatar Greendogo commented on August 19, 2024 7

This still needs to be fixed badly. Any progress on this critical issue?

OpenCV is rather useless for computer vision if you can't use it to efficiently display output.

from opencv-python.

skvark avatar skvark commented on August 19, 2024 6

The error says: "Rebuild the library with Windows, GTK+ 2.x or Carbon support.". OpenCV needs to be compiled with GTK support (WITH_GTK=ON). Currently I'm too busy to add support for this, but I'll have a look at the issue as soon as I have more spare time. Same thing with ffmpeg on Linux. Testing the builds is very time consuming stuff.

from opencv-python.

be42day avatar be42day commented on August 19, 2024 6

It's because of 'opencv-python-headless'. Uninstall it!
pip uninstall opencv-python-headless

from opencv-python.

skvark avatar skvark commented on August 19, 2024 5

The release builds for 3.3.0.10 are now in progress and the GUI supported wheels should be available to install during the next couple of hours. Please report if you have any issues with them.

from opencv-python.

owend avatar owend commented on August 19, 2024 5

Hi, I did run into an issue with headless (docker) versions of ubuntu. #44 I think anyone running opencv-python in a cloud environment without X11 is going to have the same issue.

from opencv-python.

skvark avatar skvark commented on August 19, 2024 3

I'll try to compile the packages with GTK to avoid separate packages. I hope that auditwheel / delocate can handle the dependencies automatically and embed them to the wheels. For this to work I have to fork the manylinux CentOS 5 containers and build GTK support to them manually since the default GTK provided in the EL5 repos is too old (2.10 and OpenCV needs at least 2.18). This should be easy with Docker. For macOS I'll have to go with homebrew and hope that the build times don't get too long.

from opencv-python.

KBor-DSIC avatar KBor-DSIC commented on August 19, 2024 3

pip install opencv-python fixed this issue for me

from opencv-python.

arafatx avatar arafatx commented on August 19, 2024 3

This one work for me on facefusion installation

pip uninstall opencv-python-headless -y 

pip install opencv-python --upgrade

from opencv-python.

skvark avatar skvark commented on August 19, 2024 2

I have been testing different build setups during the last two weeks. Building newer version of GTK was too complicated so instead of GTK I built Qt 4.8.7 manually on the manylinux containers. These new customized containers seem to be working fine and the Linux wheels should have GUI support in the upcoming releases.

I'll see if I can enable Qt on macOS builds too.

EDIT: Looks like I can build with Qt 4.8.7 also on macOS (Qt was preinstalled on the Travis macOS images).

from opencv-python.

skvark avatar skvark commented on August 19, 2024

On which OS you get this error? The error appears because OpenCV provided by this repo has not been built with GTK support (it can be enabled, but it requires work at least on Linux due to the Cent OS 5 containers).

from opencv-python.

esc avatar esc commented on August 19, 2024

Ubuntu 16.04

from opencv-python.

esc avatar esc commented on August 19, 2024

it would be very convenient for us to get this working, is there anything I can do to help?

from opencv-python.

fmntf avatar fmntf commented on August 19, 2024

Hi. Any progress on this?

from opencv-python.

skvark avatar skvark commented on August 19, 2024

I haven't had time to look at this.

from opencv-python.

skvark avatar skvark commented on August 19, 2024

I have an idea how this could be implemented. However, introducing a new dependency (GTK) without breaking the library import on every system is not an easy task. After all, there are hundreds of GNU/Linux distributions which don't necessarily have GTK binaries easily available (including the Cent OS 5 containers where the packages are built). Implementing this will take time and surely you know that I'm doing this for free on my limited free time.

Additionally, I don't think that OpenCV is useless without GUI features. It was never meant to be a comprehensive GUI framework. It might be good for showing images for debugging purposes, but there are many better ways to draw the images on the screen if needed. Here are few suggestions:

  • matplotlib
  • PIL (pillow)
  • scikit-image
  • tkinter
  • kivy

And you can always build OpenCV from sources.

from opencv-python.

Greendogo avatar Greendogo commented on August 19, 2024

I second having two additional modules for gtk and qt. I found that qt was easier to get working than gtk, but I'm on Ubuntu, so it wasn't super difficult. I don't think Cent OS 5 has either GTK+ 2.x (which is what imshow requires) or Qt by default, so that might not work for skvark.

@skvark - I've tried using those libraries for my purposes, however sometimes that requires rewriting large portions of code that already should work with OpenCV to instead work with another image display library. Another problem is performance, OpenCV displays images fast, which is definitely important for demo-ing a live feed from a tracking network (for example).

from opencv-python.

YerongLi avatar YerongLi commented on August 19, 2024

Get exact a same error, any idea on the a best way to fix this?

from opencv-python.

slhodak avatar slhodak commented on August 19, 2024

Should I be using a different IDE to avoid this error? I'm currently using Xcode 9.

from opencv-python.

skvark avatar skvark commented on August 19, 2024

Could you elabolarate a bit more what it is excatly you're trying to do? This issue has been closed over a year ago. All recent opencv-python (given that you installed opencv-python as described in the README) releases have GUI support. The IDE you use is not related to this library in any way.

from opencv-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.