cv2.error: OpenCV(4.5.0-dev) /home/pi/opencv/modules/highgui/src/window.cpp:651: error: (-2:Unspecified error) [closed]

asked 2020-11-16 12:03:50 -0600

Zapero gravatar image

updated 2020-11-16 12:19:57 -0600

Hallo, I have fallowed the steps provided in this tutorial https://www.tomshardware.com/how-to/r... and have tried scouring to get a fix for my issue bellow. I have the latest version of everything I can find to try and install and have re ran the Cmake twice now and I continue to run into this cv2.error can anyone help me figure out why I am unable to run the face recognition?(note I can import cv2 in python3 on the terminal and check things like version of CV but it doesn't want to work with python)

Traceback (most recent call last): File "headshots_picam.py", line 18, in <module> cv2.imshow("Press Space to take a photo", image) cv2.error: OpenCV(4.5.0-dev) /home/pi/opencv/modules/highgui/src/window.cpp:651: 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'

(also let me know if there are changes I need to make to the quire not sure how the openCV does all their questions)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by supra56
close date 2020-11-18 21:02:50.945102

Comments

sudo apt install libgtk2.0-dev and pkg-config

supra56 gravatar imagesupra56 ( 2020-11-16 12:18:20 -0600 )edit

Which rpi model?

supra56 gravatar imagesupra56 ( 2020-11-16 21:29:03 -0600 )edit

your cv2 was built without any gui support. install libgtk2.0-dev, rerun cmake, and show us the output

berak gravatar imageberak ( 2020-11-17 05:30:27 -0600 )edit

@Zapero.There is one thing in line 18... meaning that u're forgot to sudo make install after u done with make -j4. So u don't needed this install libgtk2.0-dev and pkg-config. This happened to me I left out sudo make install. This worked for me.

supra56 gravatar imagesupra56 ( 2020-11-17 07:54:10 -0600 )edit
1

@berak i have done a clean install installed the libgtk2.0dev before running cmake, ran cmake

cv2.imshow("Press Space to take a photo", image) cv2.error: OpenCV(4.5.0-dev) /home/pi/opencv/modules/highgui/src/window.cpp:651: 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'

this is the error message again

@supra56 i have run sudo make install both times (it is in the steps) and nothing im running a pi 4 model , 4 or 8 gb

Zapero gravatar imageZapero ( 2020-11-17 19:48:42 -0600 )edit

Didn't u deleted inside build folder and then do cmake again? Otherwise here is another link install opencv 4 After that, u can do face recognition. I used both rpi 3B/3B+, rpi 4B with 4/8gb

supra56 gravatar imagesupra56 ( 2020-11-17 20:46:35 -0600 )edit

Forgotten. Did u do update and upgrade before u install OpenCV 4?

supra56 gravatar imagesupra56 ( 2020-11-18 03:15:03 -0600 )edit
1

@supra56 i think i did. Let me try running that and then rerun cmake? do you think that that might fix it?

Zapero gravatar imageZapero ( 2020-11-18 12:15:32 -0600 )edit

Go ahead and try it. Don't forget to do update and upgrade before installing OpenCV 4.5.0. If u already gone into rerun cmake ...DON'T do it. //clean sd card.

supra56 gravatar imagesupra56 ( 2020-11-18 20:50:53 -0600 )edit
1

@supra56 Ok i followed the path and link you put up and everything works i have no idea what was wrong but hey its working so thanks

Zapero gravatar imageZapero ( 2020-11-18 20:55:29 -0600 )edit