OpenCV provides native camera access for android, which is great for UE4. It came with two set of libraries .a and .so. The .a libraries simply added to UE4 build system without any problems (in .build.cs, insert PublicAdditionalLibraries.Add(...) )
.so is a more tricky. In order to get camera preview, libnative_camera_r???.so has to be packed into the android apk (opencv will look for one on opening a VideoCapture). To add that .so, I use a hacked approach, I insert the following line into CopySTL in UEDeployAndroid.cs of the UnrealBuildTool:
File.Copy("[CVAndroidSDKPath]/sdk/native/libs/armeabi-v7a/libnative_camera_r4.4.0.so", UE4BuildPath + "/libs/" + Arch + "/libnative_camera_r4.4.0.so");
And that is it...
Hi There, would you be able to possibly share how you managed to get UE4 to build using Opencv for android? I have a project that I am working on that doesn't seem to build into an apk.
ReplyDeleteThanks.
This comment has been removed by the author.
ReplyDelete