how to use static opencv library - opencv

I'm trying to integrate OpenCV into my android project (using ndk).
When I made :OPENCV_LIB_TYPE:=static I can't built the project I had this error:
E:\android-ndk-r8\ndk-build.cmd all
Android NDK: Trying to define local module 'opencv_contrib' in jni/Android.mk.
E:/android-ndk-r8/build/core/build-module.mk:34: *** Android NDK: Aborting. . Stop.
Android NDK: But this module was already defined by jni/Android.mk.
Any idea how can I solve it? I'm using android-ndk-r8 and OpenCV2.4.3

I try to build two OpenCV-based native libs using single Android.mk. This known issue had been fixed at OpenCV 2.4.4 release. I need to update OpenCV4Android SDK or add OPENCV_INSTALL_MODULES:=off line before the second inclusion of opencv.mk, if I want to use this version.

Related

iOS - TensorFlow Lite Error: Select TensorFlow op(s), included in the given model is(are) not supported by this interpreter

I am trying to integrate on-device machine learning using react-native. I have converted a transformers model from huggingface to a tensorflow lite file. Doing so, I can get the model to successfully run on the android side of things. When I try to do the same for iOS I am getting this following error:
TensorFlow Lite Error: Select TensorFlow op(s), included in the given model is(are) not supported by this interpreter. Make sure you apply/link Flex delegate before inference. For the Android, it can be resolved by adding "org.tensorflow:tensorflow-lite-select-tf-ops" dependency.
TensorFlow Lite Error: Node number 95 (FlexErf) failed to prepare.
I had a similar error on the android side and I solved it using the guide here:
https://www.tensorflow.org/lite/guide/ops_select
I have followed the steps on the above link for iOS as well and yet I am still getting this error:
This includes:
Adding the dependency in the podfile
Running pod install
Adding the other flag links in the build settings.
How can I get past this error?
are you following the instruction here? Are you building for armv7 or arm64? armv7 is no longer supported in latest nightly builds and the latest nightly builds distribute xcframeworks now. So when you -force_load the framework, you might need to do -force_load $(SRCROOT)/Pods/TensorFlowLiteSelectTfOps/Frameworks/TensorFlowLiteSelectTfOps.xcframework/ios-arm64/TensorFlowLiteSelectTfOps.framework/TensorFlowLiteSelectTfOps

Exposing flutter module as IOS framework results in "Failed to find assets path for "Frameworks/App.framework/flutter_assets"

I am receiving Failed to find assets path for "Frameworks/App.framework/flutter_assets when trying to expose a Flutter project via a framework to another IOS project (Add to App via a Framework).
I created a Flutter project that i now want to expose as a native Framework for IOS. We want to share our project with other companies so that they can integrate it in their IOS application.
I followed the documentation described on https://flutter.dev/docs/development/add-to-app/ios/project-setup and i used option C. This will create an XCFramework of our Flutter module and integrate it in our native IOS Framework which will have an API to work with the flutter project. In that way our IOS Framework can be seen as an Umbrella kind of Framework but also with an exposed API.
So what i created is:
A Flutter module
An IOS Framework
An IOS Project
I build the flutter module using ./flutterw build ios-framework --cocoapods --xcframework --no-universal --output=../WhiteLabelIOSFrameWork/Flutter --verbose into the IOS Framework. I added the libraries to the Framework and i created a codespec file for the Framework with only Flutter as a dependency. Afterwards i added a Podfile to the project and added the Framework as a dependency.
All of this is working (i only needed to upgrade to Flutter 1.24.X to have this fix available https://github.com/flutter/flutter/pull/69736). But when i start my Flutter engine it's unable to find the flutter_assets (Failed to find assets path for "Frameworks/App.framework/flutter_assets).
I tried building the ios-framework directly into our IOS project and skip the in between Framework and then it seems to work. So i think it cannot find the flutter_assets since the App.framework is not in the IOS project itself, but in a Framework in between.
Is there a way to move the flutter_assets path or so? Or any other idea on how to solve this?
Kind regards,
Daan
This issue cause when you create Flutter Engine without FlutterDartProject.
Just add FlutterEngine(name: "your name", project: FlutterDartProject(precompiledDartBundle: Bundle.init(for: Self.self)))

libGDX RoboVM fork iOS build error

I always get the same strange error when I try to run the iOS version of my libGDX game. The error only shows this message: Error:com.android.tools.idea.gradle.util.Projects.lastGradleSyncFailed(Lcom/intellij/openapi/project/Project;)Z
I can sync gradle successfully but the error message stays the same. It was suggested to use the same android studio version as the RoboVM fork version, so I did that. Now I use version 2.3.0 for them both, but it wasn't fixed by doing this. To set up RoboVM I followed the instructions from the RoboVM fork website: http://robovm.mobidevelop.com/.
Does someone know how to fix this problem?
RoboVM having some incompatibly issue with Android Studio/IDEA, version 2.3.0.
Try to use MobiDevelop RoboVM 2.3.2-SNAPSHOT version that having fixes for the same.
There is a pull request for this problem in master branch, you can check that.
You can work-around this problem with Android Studio higher than 2.2 (I am using AS 3.0 Canary 3, which supports Java 8 features) by splitting your project into two separate projects, one for Android and one for iOS, sharing an imported module where all the common code is.
To set this up you will need to copy your iOS app module into a separate folder. I use this structure:
Toplevel
android
androidApp
lib
ios
iosApp
Each project should have a copy of the gradle.build, gradlew script and gradle folders - easiest way is just to duplicate the tree then remove androidApp from one and iosApp from the other.
Both the android and ios folders contain a top level build.gradle, and a settings.gradle file. The common code is in the lib directory, so the ios folder will need a settings.gradle like this
include ':iosApp', ':lib'
project(':lib').projectDir = new File('../android/lib')
while the android project settings.gradle looks like this:
include ':lib', ':androidApp'
Open each project in its own window in AS, you can now build and run them independently. You can test from the command line (often easier to debug gradle issues) by using
gradlew androidApp:assembleDebug
for the android project and
gradlew iosApp:assemble
for the ios version.
The only issue I currently have with AS 3 is an occasional null pointer error during the dexing phase in the android project. Building from the command line makes this go away for a while. You can of course use AS 2.3 which does not have this issue (but doesn't support Java 8 features like lambdas in Android.)

Yocto SDK with cmake toolchain file

I provide a Yocto SDK to cross-build an application for an embedded target. The application itself is built using CMake. The SDK setup script provides many necessary environment variables (like location of the cross-compiler, sysroot, etc.), which so far was enough to build the application.
However, since recently the application has a dependency to the Boost library (through the command find_package(Boost REQUIRED) in the CMakeLists.txt). Now CMake complains that it cannot find the library, even though it's installed in the SDK sysroot. But if I build the application directly in Yocto, it works fine.
After some research it turned out that Yocto generates a toolchain.cmake file which is added to the cmake call. In this file, the variable CMAKE_FIND_ROOT_PATH is set, which CMake needs to find libraries. Using such a toolchain file, I can also build using the SDK.
Now I'm wondering if Yocto provides any mechanism to export such a toolchain file with the SDK. Or alternatively if the SDK provides a script or something to automatically create a toolchain file directly on the SDK build host.
Or shall I just tell the users of the SDK to manually create a toolchain file and add it to their cmake call?
Assuming that you're using the image based SDK, i.e. building it with bitbake <image> -c populate_sdk, adding the following toimage.bb should fix it:
TOOLCHAIN_HOST_TASK += "nativesdk-cmake"
That should give you a OEToolchainConfig.cmake file in the SDK. After sourcing the SDK environment file, cmake will be an alias to cmake -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake to further help your developers.
I'd like to add to Anders answer that while it worked great for me to add nativesdk-cmake this way it did not work when I tried to add nativesdk-python3-numpy. After some googling I found this, suggesting that TOOLCHAIN_HOST_TASK has to be extended using _append instead of +=.

Gstreamer 1.0 ios sdk installer failed to install

This is my first time trying with Gstreamer for ios , I went with the tutorial and installed the SDK with the link provided by the tutorial:
http://docs.gstreamer.com/display/GstSDK/Installing+for+iOS+development
The installation works fine, but after I start trying the tutorial example projects, there couple of compiling errors compiling about missing gst/video/videooverlay.h . Then I looked into the header folder under the installed GStreamer header folder, there is no filed called video/videooverlay.h
Then I search online, found this information:
Gstreamer for iOS provided is out of date. I used the freedesktop packages
from https://github.com/braincorp/gstreamer_ios_tutorial
Then I downloaded another installation pkg for GStreamer
Then while I was trying to install the later version, the installer give me error saying:
you cannot install GStreamer 1.0 (Development Files) in this location.
Then I thought I might need to uninstall the previous version, but I couldn't finder a standard uninstallation option from the installer, then I searched online, find one post suggest remove the GStreamer folder under ~/Library/Developer
I have removed the installed folder, so I don't have any header files, but the new installer still gives the same error
I have been trying to figure this out for sometime, couldn't find useful info on line , I really appreicate any clue and help you might have!
Thanks!!
Jing
Answering my own question here..
not sure what's the issue, after restarting my mac, and run the installer couple of times with the same error, it suddenly worked ....... i am not sure what's the matter here, hope gstreamer team can improve the stability of the installer in the future.
At work we are currently trying to get the IOS tutorials from the streamer 1.0 sdk to run.
1) Compilation: Same thing: we managed to bootstrap (cerbero ... bootstrap) and compile (cerebra ... package streamer-sdk) using the official cerebero git repository.
But:
a) We had to mock around with the /cerbero/cerbero/enums.py file:
Add in the collection of supported old IOS (6.0, 6.1, 7.0, etc...) the one corresponding to our Xcode version : IOS 8.4
b) We had to customize the /cerbero/config/ios.config and iOS-universal.config files to get them to use the right architecture in our case: arm7v or arm7 instead of X64_86 or x86
c) We removed the not found is_asm() function from the x264 plugin's recipe file in the /cerbero/recipes.
For a reason we ignore, for all other platforms but IOS, the recipes check on the architecture available using:
if self.config.target_arch == Architecture.xxx:
of iOS is was using that missing function: is_asm(self.config.target_arch)
We replaced it by:
if self.config.target_arch == Architecture.ARMv7:
Compiling an iOS app using streamer:
So far it is a failure. we bumped into the same missing overlay.h header file. We couldn't find it anywhere.
DIFFERENCE between gstreamer.com (the sdk provider) and the official streamer website (free desktop.gsteamer.org):
We found out that gstreamer.com is clearly a commercial goal company that is making available the sdk, that people struggle on with for IOS (tested and working fine on linux) and the official website is providing the gstreamer library only without an sdk.
So this is what we are trying to use instead as of today.
Versions infos:
sdk (from gstreamer.com): current cerbero git master branch: git clone git://anongit.freedesktop.org/gstreamer-sdk/cerbero
official gstreamer library:
http://gstreamer.freedesktop.org/data/pkg/ios/1.5.2/

Resources