0

i have build OpenCV framework for IOS and i am learning OpenCV from scratch, the framework compiled well and when i am running this code :

IplImage *img = cvLoadImage("dpad_off.png");
cvNamedWindow("Example1",CV_WINDOW_NORMAL);
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Example1");

the app crash with this log :

OpenCV Error: 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 andpkg-config,
then re-run cmake or configure script) in cvNamedWindow, file            /Volumes/minijHome/Documents/xcode_mini/hillegass/advancedIOS/postCourse/openCV/clean-     downloads/openCVgitClone/opencv/modules/highgui/src/window.cpp, line 652
libc++abi.dylib: terminate called throwing an exception

i have tried to look for answer on the web but cant figure out why this is happen. any idea ?

Jack Philips
  • 57
  • 1
  • 10
orthehelper
  • 4,009
  • 10
  • 40
  • 67
  • Hi.. How did you solve this issue? I know its many years ago. I also have build the framework from scratch. But experiencing this problem. I'm trying with Xcode 9.2 and openCV 3.4.1 – user 3317704 Mar 23 '18 at 18:52

2 Answers2

5

bear with me for not knowing anything about ios, but:

the error says, that the highgui module was built without any gui support, so you can't use:

  1. cvNamedWindow
  2. cvShowImage
  3. cvWaitKey

hold your breath, that's all ok even.

basically what you're trying now, is to use desktop functions in a phone api.

i'm sure, that there are proper replacements for that in the ios api, just take a read here

berak
  • 39,159
  • 9
  • 91
  • 89
0

Change your .m class to .mm to use c++ methods. Then import the below two libraries in both classes i.e .h objective c and objective c++ wrapper class:

#import <opencv2/opencv.hpp>
#import <opencv2/imgcodecs/ios.h>
Nupur Sharma
  • 1,106
  • 13
  • 15