Ask Your Question

cvforall's profile - activity

2013-05-13 14:18:46 -0600 received badge  Supporter (source)
2013-05-12 21:17:14 -0600 commented answer Building JNI for OpenCV in Android

the tutorial I linked should work just fine, it is used by stanford as recent as last month. it's also not really an answer to my question. do you have any specific recommendations given the build error I have above?

2013-05-11 20:36:06 -0600 received badge  Editor (source)
2013-05-11 20:35:01 -0600 asked a question Building JNI for OpenCV in Android

Bear with me - this is a long description, but I wanted to include all details. I'm trying use android NDK and JNI for building OpenCV Android apps. I've also tried posting on SO with no avail.

I'm following this tutorial to get everything installed: http://www.stanford.edu/class/ee368/Android/Tutorial-2-OpenCV-for-Android-Setup-Macintosh-API8.pdf

The following installed just fine:

/usr/bin/g++
/usr/local/bin/swig
/usr/bin/cmake
/usr/bin/make
/Developer/pcre-8.32/

Contents of my .bashrc file:

export  NDK=/Users/Me/Code/Android/android-ndk-r4-crystax
export  SDK=/Users/Me/Code/Android/adt-bundle-mac-x86_64-20130219/
export  OPCV=/Users/Me/Code/OpenCV/opencv
export  PATH=$NDK:$SDK/tools:$SDK/platform-tools:$PATH
export NDK_ROOT=$NDK

Making OpenCV libraries went just fine.

Due to complaint in using make, I had to make a small edit in /Users/Me/Code/OpenCV/opencv/android/android-jni/local.env.mk which looked like so:

#ANDROID_NDK_ROOT=$(HOME)/android-ndk-r4-crystax
ANDROID_NDK_ROOT=/Users/Me/Code/Android/android-ndk-r4-crystax

Then upon trying again to make in the android-jni, directory, disaster struck:

/Users/Me/Code/Android/android-ndk-r4-crystax/ndk-build OPENCV_CONFIG=../build/android-opencv.mk \
    PROJECT_PATH= ARM_TARGETS="armeabi armeabi-v7a" V= 
Gdbserver      : [arm-eabi-4.4.0] /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi/gdbserver
Gdbsetup       : /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi/gdb.setup
Gdbsetup       : + source directory /Users/Me/Code/OpenCV/opencv/android/android-jni/jni
Gdbserver      : [arm-eabi-4.4.0] /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi-v7a/gdbserver
Gdbsetup       : /Users/Me/Code/OpenCV/opencv/android/android-jni/libs/armeabi-v7a/gdb.setup
Gdbsetup       : + source directory /Users/Me/Code/OpenCV/opencv/android/android-jni/jni
SharedLibrary  : libandroid-opencv.so
/Users/Me/Code/Android/android-ndk-r4-crystax/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/../lib/gcc/arm-eabi/4.4.0/../../../../arm-eabi/bin/ld: cannot find -lopencv_calib3d
collect2: ld returned 1 exit status
make[1]: *** [/Users/Me/Code/OpenCV/opencv/android/android-jni/obj/local/armeabi/libandroid-opencv.so] Error 1
make: *** [libs/armeabi-v7a/libandroid-opencv.so] Error 2

I thought perhaps this was a pkg-config error, but that appears to be set up as well, though in my old install of OpenCV. Below is the output of pkg-config --cflags --libs opencv:

-I/usr/include/opencv  /usr/lib/libopencv_calib3d.dylib /usr/lib/libopencv_contrib.dylib /usr/lib/libopencv_core.dylib /usr/lib/libopencv_features2d.dylib /usr/lib/libopencv_flann.dylib /usr/lib/libopencv_gpu.dylib /usr/lib/libopencv_highgui.dylib /usr/lib/libopencv_imgproc.dylib /usr/lib/libopencv_legacy.dylib /usr/lib/libopencv_ml.dylib /usr/lib/libopencv_nonfree.dylib /usr/lib/libopencv_objdetect.dylib /usr/lib/libopencv_photo.dylib /usr/lib/libopencv_stitching.dylib /usr/lib/libopencv_ts.dylib /usr/lib/libopencv_video.dylib /usr/lib/libopencv_videostab.dylib

The install built by this particular tutorial has placed an opencv.pc file at this location:

/Users/Me/Code/OpenCV/opencv/build/unix-install

BUT Running the below and trying make again doesn't fix the problem:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Users/Me/Code/OpenCV/opencv/build/unix-install

Any ideas on how I can complete this build?

2013-04-01 15:56:23 -0600 asked a question OpenCV Android tutorial building

I'm trying to run the samples included in the android opencv sdk. I've already downloaded and unpacked the android NDK, and also installed both ADT and CDT in eclipse.

So I imported the OpenCV library 2.4.4 and the "OpenCV Tutorial 2 - Mixed Processing" project. I then went into the folder for that tutorial:

OpenCV-2.4.4-android-sdk/samples/tutorial-2-mixedprocessing

and ran

ndk-build

to which I got the following:

Install        : libmixed_sample.so => libs/armeabi-v7a/libmixed_sample.so

I've verified that libs/armeabi-v7a/libmixed_sample.so indeed exists. What is causing this error? eclipse will not build the tutorial either (I've correctly set the build location for the ndk-build as well in project Properties).

what could be wrong?