Jump to content
Goolge

cv2.imshow() isn't working [edge R]

Recommended Posts

Posted (edited)

I installed devian10 on tinker-edge-r.

The following error occurred as soon as cv2.imshow() was performed with the test code.

And I try to apt-get install libgtk2.0-dev and pkg-config.
How can I resolve the error?

 

Quote

error: (-2:Unspecified error) The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Cocoa 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'

 

 

Edited by Goolge

Share this post


Link to post
Share on other sites

hello @Goolge

what is your test code? have you done what the notice suggested?

(If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage')

Share this post


Link to post
Share on other sites

just tested the cv2.imshow() function on my side and no errors shown. if the debian 10 os you're using is the official release from our website, python/ opencv pakages are built in the image; if you're using a third party debian 10 os, maybe follow this tutorial to get all the necessary libs/ pkgs installed: https://linuxize.com/post/how-to-install-opencv-on-debian-10/

Share this post


Link to post
Share on other sites
On 9/2/2022 at 5:07 PM, tooz said:

just tested the cv2.imshow() function on my side and no errors shown. if the debian 10 os you're using is the official release from our website, python/ opencv pakages are built in the image; if you're using a third party debian 10 os, maybe follow this tutorial to get all the necessary libs/ pkgs installed: https://linuxize.com/post/how-to-install-opencv-on-debian-10/

Thank you very much.
I almost gave up.
I'll give it a try.

I have one more question.
Two webcams were connected in the tinker edge. 'cv2.open' works well for two webcams, but only one webcam can be read. How do I 'cv2.read' two webcams at the same time?

Share this post


Link to post
Share on other sites

Hi,

Usually, before you use `cv2.open`, should have a define codes to let cv2 know use which camera.

so should such as:

import cv2
cam0 = cv2.VideoCapture(0)
cam1 = cv2.VideoCapture(1)
ret0, frame0 = cam0.read()

and node ID is based on your camera node in system.

Share this post


Link to post
Share on other sites
On 9/2/2022 at 9:07 AM, tooz said:

just tested the cv2.imshow() function on my side and no errors shown. if the debian 10 os you're using is the official release from our website, python/ opencv pakages are built in the image; if you're using a third party debian 10 os, maybe follow this tutorial to get all the necessary libs/ pkgs installed: https://linuxize.com/post/how-to-install-opencv-on-debian-10/

i have downloaded the debian 10 official realease from tinker board asus website and then followed your suggested tutorial to install opencv but i am still getting the error:

error: (-2:Unspecified error) The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Cocoa 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'

 

Edited by marco@bigsis.tech

Share this post


Link to post
Share on other sites

Hi,

thank you for your reply. No, I am building it on the Tinker Edge R, and the downloaded version of opencv after following that  tutorial is 4.6.0.

I also tried to execute the RKNN toolkit which gives opencv 4.4.0 and still got that error message.

Edited by marco@bigsis.tech

Share this post


Link to post
Share on other sites
19 minutes ago, tooz said:

hello @marco@bigsis.tech

which version of opencv were you building? were you building it on tinker board 2s?

Hi,

thank you for your reply. No, I am building it on the Tinker Edge R, and the downloaded version of opencv after following that  tutorial is 4.6.0.

I also tried to execute the RKNN toolkit which gives opencv 4.4.0 and still got that error me

Edited by marco@bigsis.tech

Share this post


Link to post
Share on other sites

hello @marco@bigsis.tech

i was testing tinker board 2s and did manage to compile opencv:

sudo apt-get update
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev


git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout 4.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python2=OFF \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D WITH_GSTREAMER=ON ..
make && sudo make install

 

will check on tinker edge r and let you know 

Share this post


Link to post
Share on other sites
2 minutes ago, tooz said:

hello @marco@bigsis.tech

i was testing tinker board 2s and did manage to compile opencv:

sudo apt-get update
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev


git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout 4.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python2=OFF \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D WITH_GSTREAMER=ON ..
make && sudo make install

 

will check on tinker edge r and let you know 

thank you for your response, I will try uninstall opencv and recompile it with your modification and let you know as well

Share this post


Link to post
Share on other sites
16 hours ago, marco@bigsis.tech said:

Hi,

thank you for your reply. No, I am building it on the Tinker Edge R, and the downloaded version of opencv after following that  tutorial is 4.6.0.

I also tried to execute the RKNN toolkit which gives opencv 4.4.0 and still got that error message.

hello @marco@bigsis.tech

so the version of opencv-python was upgraded, if you've encountered import cv2.imshow() error, please remove the build-in opencv-python:

python3 -m pip uninstall opencv-python

then re-install:

python3 -m pip install opencv-python --user 

 

Share this post


Link to post
Share on other sites
1 hour ago, tooz said:

hello @marco@bigsis.tech

so the version of opencv-python was upgraded, if you've encountered import cv2.imshow() error, please remove the build-in opencv-python:


python3 -m pip uninstall opencv-python

then re-install:


python3 -m pip install opencv-python --user 

 

Hi,

thank you again for your quick response.

at the end I was able to solve the error by re-compiling opencv  following the same tutorial  BUT  installing  libgtk2.0-dev  instead of libgtk-3-dev.

I will try your suggestion as well.

However I am currently facing another problem..

I am trying to capture videos from 4 usb cameras.  I am able to preview only 3 cameras together, but if I try with 4 I gets the following error:

(-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow

Any suggestion please?

 

 

WhatsApp Image 2022-11-24 at 10.22.13.jpeg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...