Error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support

I am trying to run a simple face detection on an ARMs target. I managed to cross compile all libraries and my source code but when executing on the target i get this error:

terminated call after throwing an isntance of ‘cv::Exception’ what(): OpenCV(4.8.0-dev) /home/…/highgui/src/window.cpp:1272 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’

I read on a defferent entry that reinstalling python-opencv with pip solved the problem. Since i am on a ARMs target, thats not an option. I am also not sure if the opencv_python is inckuded in the normal opencv source (GitHub - opencv/opencv: Open Source Computer Vision Library) ?

Thank you for help

----> Code

#include<opencv2/imgcodecs.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<opencv2/objdetect.hpp>
#include
using namespace std;
using namespace cv;
/void main() {
string path = “chando.jpg”;
Mat img = imread(path);
imshow(“Frame”, img);
waitKey(0);
}
/
int main(int argc, char **argv) {
VideoCapture video(3);
CascadeClassifier facedetect;
Mat img;
facedetect.load(“haarcascade_frontalface_default.xml”);
while (true) {
video.read(img);
vector faces;
facedetect.detectMultiScale(img, faces, 1.3, 5);
cout << faces.size() << endl;
for (int i = 0; i < faces.size(); i++) {
rectangle(img, faces[i].tl(), faces[i].br(), Scalar(50, 50, 255), 3);
rectangle(img, Point(0,0), Point(250,70), Scalar(50, 50, 255), FILLED);
putText(img, to_string(faces.size())+" Face Found", Point(10, 40), FONT_HERSHEY_DUPLEX, 1, Scalar(255, 255, 255), 1);
}
imshow(“Frame”, img);
waitKey(1);
}
return 0;
}

no, unfortunately not so. how would any python install change your c++ code ?

yes it is, look at modules/cv2 (it’s generated from c++ headers …)
but again, looking at python wont help at all, if you’re doing c++

so, you do not have any gui builtin atm, bc. it could not find arm compiled gtk or qt libs at compile time of the libs.

for now, maybe just save the image to disk, and use an external viewer to visualize, then find out, how to cross-compile qt for arm …

okay that makes sense. I dont really need to display the image somewhere. I just need to write to the console if a face is detected. Would that be possible ?

sure, just cout what you send to putText() now

So after i removed “imshow” it still doesnt work with the same error message do you have any ideas ?

waitKey() has to go as well

Its running now! Thanks a lot!