This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cv2.imshow() command doesn't work.
#1
Hello,  I have just started using Tinker Edge-R board. Smile

condition
OS:   Tinker Edge R Debian Stretch V1.0.4
OpenCV version: 3.4.11
Pyrhon3.5.3

When I run a simple python code, I always get a below error message.

Python 3.5.3 (default, Jul  9 2020, 13:00:10)

[GCC 6.3.0 20170516] on linux

Type "copyright", "credits" or "license()" for more information.

>>> import cv2

>>> cv2.__version__

'3.4.11'

>>>

=============== RESTART: /home/linaro/Python_Scripts/circle.py ===============

Traceback (most recent call last):

  File "/home/linaro/Python_Scripts/circle.py", line 17, in <module>

    cv2.imshow('img1',img)
cv2.error: OpenCV(3.4.11) /home/linaro/Downloads/opencv-3.4.11/modules/highgui/src/window.cpp:658: error: (-2:Unspecified error) 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'
-----------------------------------------------------------------------------------------

It seems Python code of opencv works except cv2.imshow() command  even if above condition.
IF I comment out cv2.imshow('img1',img) -> #cv2.imshow('img1',img), no error has been caused.
waitKey(0) and destroyAllWindow() cause an error, too. 

Would you support to solve this issue ?

Then I tried to install the libgtk2.0-dev and pkg-config.

But I have an error about libgtk2.0-dev installation like a following.(pkg-config should be OK.)

Thank you for your strong support in advance.

--------------------------------------------------------------------------------------------------------------------------
linaro@linaro-alip:~/Downloads/opencv-3.4.11/build$ sudo apt-get install libgtk2.0-dev

Reading package lists... Done

Building dependency tree      

Reading state information... Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:



The following packages have unmet dependencies:

 libgtk2.0-dev : Depends: libxinerama-dev (>= 1:1.0.1-4.1) but it is not going to be installed

                 Depends: libxrandr-dev (>= 2:1.2.99) but it is not going to be installed

                 Depends: libxcomposite-dev (>= 1:0.2.0-3) but it is not going to be installed

                 Depends: libxdamage-dev (>= 1:1.0.1-3) but it is not going to be installed

E: Unable to correct problems, you have held broken packages.



Next try -> 

linaro@linaro-alip:~/Downloads/opencv-3.4.11/build$ sudo apt-get install libgtk2.0-dev \

> libxinerama-dev libxrandr-dev libxcomposite-dev libxdamage-dev

Reading package lists... Done

Building dependency tree      

Reading state information... Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:



The following packages have unmet dependencies:

 libxcomposite-dev : Depends: x11proto-composite-dev (>= 1:0.4)

 libxdamage-dev : Depends: x11proto-damage-dev (>= 1.1)

 libxinerama-dev : Depends: x11proto-xinerama-dev (>= 1.2)

 libxrandr-dev : Depends: x11proto-randr-dev (>= 1.4)

E: Unable to correct problems, you have held broken packages.



Next next try -> 

linaro@linaro-alip:~/Downloads/opencv-3.4.11/build$ sudo apt-get install libgtk2.0-dev libxinerama-dev libxrandr-dev libxcomposite-dev libxdamage-dev \

> x11proto-composite-dev x11proto-damage-dev x11proto-xinerama-dev x11proto-randr-dev

Reading package lists... Done

Building dependency tree      

Reading state information... Done

Some packages could not be installed. This may mean that you have

requested an impossible situation or if you are using the unstable

distribution that some required packages have not yet been created

or been moved out of Incoming.

The following information may help to resolve the situation:



The following packages have unmet dependencies:

 libgtk2.0-dev : Depends: libxi-dev (>= 1:1.0.1-4) but it is not going to be installed

 x11proto-dev : Breaks: x11proto-composite-dev (< 1:2018.3)

                Breaks: x11proto-damage-dev (< 1:2018.3)

                Breaks: x11proto-randr-dev (< 2018.3)

                Breaks: x11proto-xinerama-dev (< 2018.3)

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
linaro@linaro-alip:~/Downloads/opencv-3.4.11/build$  
Reply
#2
I could solved this issue by following procedure.

sudo apt-get install x11proto-xinerama-dev
#result OK
sudo apt-get install libgtk2.0-dev
#result OK

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j4
sudo make install

Sorry for bothering you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)