After using Levenberg-Marquardt optimization library from Lourakis in Android-NDK, this time I tried another library that offers non-linear least square solver called Ceres-Solver Library from Google.
https://code.google.com/p/ceres-solver/
From the specification and the demo, it is clear that this library shows impressive result (google map demo). And most importantly, this library already put one folder JNI inside it. It means we can quickly use it for our Android application.
For augmented reality application, I use ceres-solver for minimizing the reprojection error of the camera pose that is produced by our algorithm (refer this work for the detail). The result is comparable with the result I produced in the last post using Levenberg-Marquardt library. The good point is this solver offers sparse solver as well, and as written in the tutorial, it can be applied for solving the bundle adjustment step, which is suitable for our purpose.
The step for using ceres-solver for android-ndk:
LOCAL_PATH := $(call my-dir)
https://code.google.com/p/ceres-solver/
From the specification and the demo, it is clear that this library shows impressive result (google map demo). And most importantly, this library already put one folder JNI inside it. It means we can quickly use it for our Android application.
For augmented reality application, I use ceres-solver for minimizing the reprojection error of the camera pose that is produced by our algorithm (refer this work for the detail). The result is comparable with the result I produced in the last post using Levenberg-Marquardt library. The good point is this solver offers sparse solver as well, and as written in the tutorial, it can be applied for solving the bundle adjustment step, which is suitable for our purpose.
The step for using ceres-solver for android-ndk:
- download the library from https://code.google.com/p/ceres-solver/ (eigen library is necessary as well)
- go to the jni folder after extracting it
- build the library using ndk-build. it will yield libceres.a
- grab the libceres.a
- we will use the libceres.a as a static library for our project
Now, in our project, let's use the libceres.a and this is my Android.mk that uses libceres.a
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
include $(CLEAR_VARS)
LOCAL_MODULE := ceres
LOCAL_SRC_FILES := libceres.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += eigen
LOCAL_C_INCLUDES += ceres-solver-1.7.0/include
LOCAL_C_INCLUDES += ceres-solver-1.7.0/include
LOCAL_C_INCLUDES += ceres-solver-1.7.0/internal/ceres/miniglog
LOCAL_MODULE := myproject
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_STATIC_LIBRARIES = ceres
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
Don't forget to change the path of the ceres-solver and eigen includes path.
In my error project, I use the linear-solver type DENSE_SCHUR as shown in the bundle adjustment tutorial. I also tried to change using SPARSE_NORMAL_CHOLESKY that can run faster but less accurate because I guess our problem is not dealing with sparse data. This solver can help to produce the camera pose even in the extreme tilt.
This is the snapshot of my implementation of shape tracking in android using ceres-solver. The camera pose can be computed as shown by the red outline in the images. Tested using Nexus 7.
In my error project, I use the linear-solver type DENSE_SCHUR as shown in the bundle adjustment tutorial. I also tried to change using SPARSE_NORMAL_CHOLESKY that can run faster but less accurate because I guess our problem is not dealing with sparse data. This solver can help to produce the camera pose even in the extreme tilt.
This is the snapshot of my implementation of shape tracking in android using ceres-solver. The camera pose can be computed as shown by the red outline in the images. Tested using Nexus 7.
Hi,
ReplyDeleteI am developing an app with ceres on Android. I'm using cmake. I have built ceres and lapack, blas (comes with levmar). I have static libs of them. However I could not compile them all in Android side. I got undefined reference for 2 functions inside lapack and blas(dgels_and dsyrk_). I have added include files. The functions are there but linker could not link it. Could you please help me with the issue?
Thanks.
KFabio
Hi, just want to know where do we put the ectracted lib before go to the jni folder? thanks!
ReplyDeleteYdaxaza_ya Yolanda Logan https://www.robinsnest.online/profile/Witch-It-V0602-Fixed-Hack-Torrent/profile
ReplyDeletetairehyra