Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.
422 Discussions

The cv2 GUI doesn't work. How could I fix it ?

HL2
Beginner
2,245 Views

Hi, 

I am using Debian 9. Using conda installed the intel python distribution. The OpenCV package's GUI module doesn't work. 

The error messages are:

error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

 

How could I fix it ? Thanks!

 

0 Kudos
3 Replies
Rohit_J_Intel
Employee
2,245 Views
Hi Hui,
 
We don't build OpenCV with GTK support; you can build using sources with support for GTK. You need to have libgtk / libgtk2.x installed at a path that could be discovered by build script. Depending on the version of libgtk installed, passing "-DWITH_GTK=1" / "-DWITH_GTK_2_X=1" to cmake would ensure that built OpenCV has GTK support, and you'd be able to use "cv.ShowImage()" from the interpreter.
 
Thanks,
Rohit
0 Kudos
HL2
Beginner
2,245 Views

Rohit J. (Intel) wrote:

Hi Hui,

 

We don't build OpenCV with GTK support; you can build using sources with support for GTK. You need to have libgtk / libgtk2.x installed at a path that could be discovered by build script. Depending on the version of libgtk installed, passing "-DWITH_GTK=1" / "-DWITH_GTK_2_X=1" to cmake would ensure that built OpenCV has GTK support, and you'd be able to use "cv.ShowImage()" from the interpreter.

 

Thanks,

Rohit

Hi Rohit, 

Thanks for your reply. I know how to compile OpenCV with a GUI support, but is the OpenCV module from Intel's channel optimized with MKL and other routines ?  This is the reason why I use intel's python distribution. I wonder what's the difference between intel's OpenCV module and the one I could build from source codes ?  If there's no big difference, I could build it myself. 

Thanks, 

Hui

0 Kudos
Rohit_J_Intel
Employee
2,245 Views
Hui,
 
We build opencv with icc/icpc and link against runtimes from Intel IPP and Intel TBB, besides linking against runtimes from zlib, hdf5, libtiff, libpng and libjpeg. Since you have IDP installed, you can create a conda-env with all the prerequisites and can build opencv in that environment.
 
1. In order to create a conda-env with all the prerequisites: <IDP_installation>/bin/conda create -n opencv_build_env -c intel python=3.6 ipp-devel numpy hdf5 jpeg libtiff libpng protobuf -y
2. Activate conda-env: source <IDP_installation>/bin/activate opencv_build_env
3. Install tbb-devel from the beta channel : conda install -c intel/label/beta2019 tbb-devel -y #Please note that this package is a beta package. We would soon be pushing a stable release.
 
In the activated environment, all your runtimes and header-files would be placed under `python3-config --exec-prefix`/lib and `python3-config --exec-prefix`/include, respectively. You can pass appropriate arguments to cmake to ensure that all the header files and runtimes are being utilized during build.
 
Thanks,
Rohit
(p.s. You can deactivate a conda-env by running the following: source deactivate)
0 Kudos
Reply