Ask Your Question

Revision history [back]

How to? Aruco java...

Hello all. I build OpenCV and Aruco module, from Git... Build script:

mkdir -p build_android_armeabi-v7a
cd build_android_armeabi-v7a

cmake \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_SDK=/Users/admin/Library/Android/sdk \
-DANDROID_NDK=/Users/admin/Library/Android/sdk/ndk-bundle \
-DANT_EXECUTABLE=/Users/admin/Documents/apache-ant/bin/ant \
-DJAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home \
-DJAVA_JVM_LIBRARY=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/include/jni.h \
-DJAVA_INCLUDE_PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/include \
-DCMAKE_TOOLCHAIN_FILE=../android/android.toolchain.cmake $@ ../..

everything went well. i include libraries and generated java classes in Android Studio. OpenCV is working, I tried several functions and it works. But with Aruco something is wrong, it always crash on Aruco.detectMarkers

Mat inputImage = inputFrame.gray();
List<Mat> corners = new ArrayList<>();
Mat ids = new Mat();
Dictionary dictionary = Aruco.getPredefinedDictionary(Aruco.DICT_6X6_250);
Aruco.detectMarkers(inputImage, dictionary, corners, ids);

if i will use this:

List<Mat> rejectedImgPoints = new ArrayList<>();
DetectorParameters detectorParameters = DetectorParameters.create();
Aruco.detectMarkers(inputImage, dictionary, corners, ids, detectorParameters, rejectedImgPoints);

i always get assert in this line:

CV_Assert(params->adaptiveThreshWinSizeMin >= 3 && params->adaptiveThreshWinSizeMax >= 3);

Please help! I would not want to use C ++ code. I want to write a program in Java only.