Use OpenCV in existing Java Android application - android

I need to have some code to do some image processing in an existing Android app written in java. Currently my code is written in Python with OpenCV, and running on a PC.
Now I need it too run in the said app too.
I tried running it via sl4a with py4a, which for simple python scripts is OK, but I need to use OpenCV, and couldn't figure how to format it for py4a. (Any idea how to do this?)
What are my options for running Python code using OpenCV inside of an existing Java Android app?

Related

Running python script with Numpy and OpenCV on Android

I have a complicated image processing script that runs in python with Numpy and OpenCV.
I want to run this script in Android but I couldn't find a way to do it.
After some research I found some frameworks that may help but I have some problems with them:
Kivy only generates full APK, but what I need is an AAR or some background service so I could use it from other apps
QPython only runs scripts, I didn't find a way to communicate with it from my app
cxfreeze I've tried to generate executable out of my script and then running it from my app, but I couldn't find a way to compile my script to an ARM processor so Android would be able to execute it
I will be happy to hear some ideas on how to run this script in Android.
Is it possible to maybe root the device and install Python, Numpy and OpenCV?
The best solution for me was using steveliles's OpenCv for Android and converting the Python scripts to Java. Turns out opencv had all the mat calculation functions I needed
Another solution would be using chroot:
https://technohackerblog.blogspot.co.il/2016/07/running-arch-linux-in-chroot-on-android.html
I would give a try to Kivy Launcher
you'll have to build it with opencv and numpy support
please see: How to run OpenCV in Kivy Launcher? for details on that.
after the first build you'll have an app that can run your script and you won't have to generate the APK again, just change the script :)
Another option is https://termux.com, but you'll have a bit of hard time getting cv2 to work on it.

Python and openCV to android APK

I want to transform my python code into an Android app. The problem I saw is I'm using openCV in the code, and I didn't found anything related to generate an APK while using openCV.
There is a way to generate an APK from python and openCV?
There is SL4A / PythonForAndroid but unfortunately it uses hardcoded Java RMI invocations for anything os related. That means that there are no OpenCV bindings.
I guess you'll have to learn Java

Using Python scripts in Android for image processing

I have some python scripts which are doing image processing work using its own numpy and scipy libraries. How can I use/call these scripts in Android application providing image input from camera captures and saving the images after processed. Is there some native support for Python like C++. What performance implications would be there if I compare with using C++ as a native support. Any help would be greatly appreciated.
You can use QPython to run python scripts in android. It's a powerful program. Or use Kivy to develop cross platform apps with python. And a better solution is http://code.google.com/p/android-python27/ an embeded python iterpreter!!
Try Pydroid, the best IDE on Android, autocompletion and code analysis works awesome, supports most of the libraries you need
You need a Python Interpreter to run Python scripts,Pydroid Gives you access to compile Python scipts and comes with pip,So you could Install new Python Modules,it's the only app that gives a real Experience of Programming using python.

Running OpenCV Python code on Rooted Android

I tried using QPython, but had difficulties in installing numpy, let alone OpenCV . Is there anyway I can run my OpenCV code on android? I have read this answer, Is there a way to run Python on Android? , however, I need to know if OpenCV is supported in particular. If not, is it possible to run it on a rooted android phone?

Import python code in android project

I have a monitoring application that can be used to monitor devices using android. I currently have the code in python that I run from windows via ADB and get the results on windows in a CSV file.
I would like to create an android project that would behave as described above (an APK, in Java on eclipse), so I can run it without using ADB.
Is there a possibility that I can include the existing python code and call the methods from the old code (after installing the apk on an android device)?
Despite my online research - I could not get appropriate results. Can someone help me out here?
Thank you.
Did you check SL4A and Py4A ?
http://code.google.com/p/python-for-android/
You may check QPython too.

Categories

Resources