ArucoUnity
                                
                                 ArucoUnity copied to clipboard
                                
                                    ArucoUnity copied to clipboard
                            
                            
                            
                        Can we use it for Android?
Thanks for awesome plugin. Can it be used for mobile phone (android)?
Yes, it is usable on android.
First, you will need to download/compile opencv with opencv_contrib included. Then you need to build ArucoUnityPlugin linking to your android opencv build, and using the android toolchain. Finally you place the generated .so in your assets folder and specify that it should only be used on Android.
Thanks
On Tue, 4 May 2021 at 04:34, danem @.***> wrote:
Yes, it is usable on android.
First, you will need to download/compile opencv with opencv_contrib included. Then you need to build ArucoUnityPlugin https://github.com/NormandErwan/ArucoUnityPlugin linking to your android opencv build, and using the android toolchain. Finally you place the generated .so in your assets folder and specify that it should only be used on Android.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NormandErwan/ArucoUnity/issues/43#issuecomment-831599448, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBPJMEJPU7IGDDWFJOC6T3TL4XHLANCNFSM424UXKCA .
Heyho, I know it may be a bit late, but if anyone else stumbles over this and does not have as much experience with building from sources and building for android in general. I have struggled a bunch on this topic, here is what exactly you need to build arucounity from sources for Android(on Windows):
Download (Versions are very important):
(Only if you don't have it already --> Cmake Gui and MinGW installer )
- Python2 AND 3
- Clone or download ArUcoUnityPlugin and ArUcoUnity
- Clone or download OpenCV 3.4.6 and OpenContrib 3.4.6
- install Android SDK (easiest with Android studio for any android version you need)
- Get NDK r15c (https://github.com/android/ndk/wiki/Unsupported-Downloads#ndk-15c-downloads)
- Android SDK Tools 25.2.5 (https://stackoverflow.com/a/43050706) and put it into --> ".../AndroidSDK/tools_25.2.5/" = $TOOLS_25.2.5_FOLDER
Generate OpenCV MakeFiles with OpenContrib using AndroidToolchain:
- Source Code: $SourceDirectoryOpenCVCore
- Build directory: $BuildDirectoryOpenCV
- Click Configure --> MinGW Makefiles --> Specify Toolchain file for cross-compiling --> "../android-ndk-r15c/build/cmake/android.toolchain.cmake" (change folder for your own folder structure)
- Wait for Cofiguration to stop by itself with an Error (no SDK specified)
- "ANDROID_HOME"=$ANDROIDSDK_FOLDER (change for your own structure)
- "ANDROID_SDK_TOOLS"=$TOOLS_25.2.5_FOLDER (change for your own structure)
- "OPENCV_EXTRA_MODULES_PATH"=".../opencv_contrib/modules/" (change for your own structure)
- Disable BUILD_ANDROID_PROJECTS
- Disable BUILD_ANDROID_EXAMPLES
- Disable BUILD_PERF_TESTS
- Disable BUILD_TESTS
- optional: Disable all Extra Modules not needed (Needed: Calib3d and Ccalib), but don't disable core modules
- Ignore warning about Cmake required Version. If you get errors here, switch cmake version to 3.22 or older (It worked with 3.22)
- --> Configure
- --> Generate
Generate ArUcoUnityPlugin MakeFiles linked with [Android OpenCV with OpenContrib] using AndroidToolchain
- Source Code: $SourceDirectoryArUcoUnityPlugin
- Build directory: $BuildDirectoryArUcoUnityPlugin
- Click Configure --> MinGW Makefiles --> Specify Toolchain file for cross-compiling --> "../android-ndk-r15c/build/cmake/android.toolchain.cmake" (change folder for your own folder structure)
- Wait for it to fail configuring
- "OpenCV_DIR" = $BuildDirectoryOpenCV
- "ArucoUnity_DIR" = $SourceDirectoryArucoUnity
- --> Configure
- --> Generate
Build OpenCV with OpenContrib using Android Toolchain:
- open Terminal "cmake --build $BuildDirectoryOpenCV"
- Wait for it to finish (make a coffee or something, that will take a while (30-60 Minutes maybe?)
- finish
Build ArUcoUnityPlugin
- open Terminal "cmake --build $BuildDirectoryArUcoUnityPlugin"
- There may be a lot of Compiler errors.
- Replace all ">>" with "> >" in the files with those errors.
- It is not possible to break something with just pressing "replace all", I tried it.
- finish
After this you got the needed "libArucoUnityPlugin.so" in $BuildDirectoryArUcoUnityPlugin This all needs to be done in this order with these Versions of each part (maybe there is some other combination possible but it was really tedious to figure out)
Hi @Surlix, Thank you for the detailed steps. I followed the steps and stumbled upon an error at the end of the step after replacing all the '>>' with '> >', saying "No member named 'drawAxis' in namespace 'cv::aruco'. The error occurred in "ArucoUnityPlugin-Master\src\aruco_unity_plugin.cpp" at line 65:18
Can you please suggest a turn around? Thanks