ofxAruco on Android - libraries? ofxCv? ofxOpenCv?

Hi everyone!

I’m trying to get ofxAruco running on Android, but I’m having problems…

Including ofxAruco in addons.make alone brings up the error “ofxOpenCv.h: No such file”, so I added ofxOpenCv. This then again brings the error “ofxAruco.cpp: ‘ofxCv’ has not been declared”, so I added ofxCv. This, though doesn’t resolve the previous error. So I manually included ofxCv.h in ofxAruco.cpp. After that the project finally builds, but the linking goes wrong, I get

…/…/…/addons/obj/android/x86/Release/ofxOpenCv/src/ofxCvShortImage.o:ofxCvShortImage.cpp:function ofxCvShortImage::addWeighted(ofxCvGrayscaleImage&, float): error: undefined reference to ‘cvAddWeighted’
(and many more of those undefined references)
collect2: error: ld returned 1 exit status
make[1]: [libs/x86/libOFAndroidApp.so] Error 1
make: [Release] Error 2

Any ideas? Do I really need both ofxCv and ofxOpenCv? Am I doing something else wrong?

Thanks for your help!

  • Benni

the addon only uses ofxCv but the libraries for opencv are in ofxOpenCv so the easiest way to include them is to add that addon to the project.

the error you are getting is because we added support for android x86 in 0.8.1 but forgot to compile opencv for that platform, you can fix it by adding the following lines at the end of config.make:

ABIS_TO_COMPILE_RELEASE = armv7
ABIS_TO_COMPILE_DEBUG = armv7

which will remove support for x86 for that project

2 Likes

Hi Arturo,

thanks for the hints, indeed this worked!

Best, Benni.

I was a bit fast there: Right after adding those two lines to config.make, something really weird happens… I can build and run the project and apparently it gets installed on my device (a Fairphone). But once it starts up it won’t reflect any changes I make to the source code, so it’s like the last version of the app that I had running before adding those lines. I don’t get any errors in the console or LogCat…

My phone isn’t x86, though, but Armv7, so it should work, shouldn’t it?

Thanks,
Benni.

i’ve seen that happen with some older versions of eclipse but i hadn’t have that error in a while, try deleting the .apk from the bin folder and also uninstalling it from the phone and running it again

Hmm, that didn’t do the trick either. But as soon as I removed the two lines from config.make, it took the changes I did in the code (except that I couldn’t use ofxCv etc…).

Now what I just tried was including ofxAruco to the OpenCv-Example which came with of_android and there it actually works. No idea why, but I’ll go from there :-). (Before I worked on a copy of the CameraExample…)

Anyways, thanks for your time! Do you have something like a tip jar? :wink:

Best, Benni.

I am not sure I should ask it here or make a new topic as my question is very related. My method to ofxAruco for android studio was as follows:

  1. Clone ofxAruco and ofxCv in addons folder.
  2. Copy files from ofxaruco/bin/data to bin/data folder of androidEmptyExample
  3. Update addons.make and include ofxOpenCv, ofxCv, ofxAruco.
  4. update main.cpp file and ofApp.h and cpp files as given in example.

make project is done successfully however when I try to run it I am faces with three errors.

  1. Error:(48, 30) error: ‘ofBitmapStringGetTextureRef’ was not declared in this scope
  2. Error:(56, 29) error: ‘class ofBaseVideoDraws’ has no member named ‘getPixelsRef’
    3.Error:(157, 1) A problem occurred evaluating project ‘:openFrameworksProject’. make failed with exit status 2