Comments (30)
There is no camera implementation in Kivy right now. And we never said than opencv was available on python-for-android too.
The list of available recipes can be retrieved with ./distribute.sh -l
Or browisng https://github.com/kivy/python-for-android/tree/master/recipes
The fix is... to do it.
from python-for-android.
So if I only include "opencv" the process of compiling the camera will work?
Keep in mind that I started using "Kivy" very recently.
from python-for-android.
I disagree with this statement:
- "There is no camera implementation in Kivy right now"
- http://kivy.org/docs/api-kivy.uix.camera.html
I agree with the statement:
- "And we never said than opencv was available on python-for-android too"
Ok, no problem.
- "The fix is... to do it."
from python-for-android.
There is no camera implementation in Kivy "for android platform". :) You are on the python/android project, so the context was implies.
The issue is not only to get opencv compiled for ARM/android, but also implement a provider for android. It seem that OpenCV have now a camera support for android, but it need a closer look to see how it need to be integrated into our java code, and if it's still possible to use their Python API. Or another way.
from python-for-android.
WRT OpenCV for Android, I managed to compile it for Python and successfully imported it in Python. However camera functionality in OpenCV is somehow broken in Kitkat 4.4.2.
from python-for-android.
Do you mean you compiled the OpenCV Python library for arm/android using python-for-android? If yes, would you mind sharing the recipe?
from python-for-android.
Hi Bastian Venthur,
I did compiled the OpenCV Python library for Android(ARM). However, I
didn't write any recipe files to achieve this. It was done by creating a
new Android project in ADT, and feeding everything the cross compiler
needed into the project.
More specifically, the OpenCV building environment uses some automatic
wrapper for Python library generation. During compile time, some header
files are generated by the wrapper to provide C++-Python interoperability
and functionality. However the OpenCV CMake environment disables Python
library generation for Android, so these header files are not created.
One can simply put the generated headers from a Linux OpenCV for Python
build into the Android project, and put the pre-compiled opencv_java.so
library for Android into the same project and compile. Then you can get a
fully-functional cv2.so for Android (or partially-functional for it doesn't
support HighGUI).
I can send you a copy of the Eclipse project I used to build the library,
if you need.
Regards,
Peng
2014-05-23 6:21 GMT+08:00 Bastian Venthur [email protected]:
Do you mean you compiled the OpenCV Python library for arm/android
using python-for-android? If yes, would you mind sharing the recipe?β
Reply to this email directly or view it on GitHubhttps://github.com//issues/75#issuecomment-43951254
.
from python-for-android.
Hi barius,
I am trying to do the same, wrap opencv with python for android.
I am relatively new to android, it would be much helpful if you could share the procedure you followed and the required project files.
Regards,
Ashok
from python-for-android.
@ParokshaX @venthur
Here I attach the Eclipse project I have made to build libcv2.so for Python on Android. It is a little bit messy because I really had a headache working it out, and I'm short on time right now.
Just import it into Eclipse (I use ADT 22.0 and NDK r9c) and it should compile. I took libopencv_java.so into the project so it shall be a dependency. Also libpython2.7.so is a dependency too.
If anyone can make this into a Python for Android recipe then that would be awesome.
The link:
https://drive.google.com/file/d/0B7iBG-Vnm4w1SjFhXzItSmQ5OG8/edit?usp=sharing
Regards,
Peng
from python-for-android.
@barius
Thanks, I managed to build it by using opencv's cmake, however I have problem with the numpy recipe!
from python-for-android.
@ParokshaX
Glad to hear that you worked it out.
About numpy, AFAIK you cannot build P4A w/o Kivy, e.g.this works fine
./distribute.sh -d dist1 -m numpy pil kivy
but
./distribute.sh -d dist1 -m numpy pil
does not.
No idea what your case is, just trying to help.
from python-for-android.
@barius
I used ./distribute.sh -m openssl pil kivy numpy
but it failed with numpy as it is trying to build lapack library which requires gfortran for arm which is not provided by android-ndk, the patch provided in the recipe doesn't seem to work, could be relative to the distro (arch linux) i am using. Have to dig into it further to find where it went wrong.
Is it possible that you could share the numpy-android which you built, so I can test run the opencv I built using cmake and verify its integrity?
from python-for-android.
try put numpy in front of kivy first π
2014-7-25 δΈε12:20δΊ "Ashok Kumar P (ParokshaX)" [email protected]ειοΌ
@barius https://github.com/barius
I used ./distribute.sh -m openssl pil kivy numpy but it failed with numpy
as it is trying to build lapack library which requires gfortran for arm
which is not provided by android-ndk, the patch provided in the recipe
doesn't seem to work, could be relative to the distro (arch linux) i am
using. Have to dig into it further to find where it went wrong.Is it possible that you could share the numpy-android which you built, so
I can test run the opencv I built using cmake and verify its integrity?β
Reply to this email directly or view it on GitHub
#75 (comment)
.
from python-for-android.
@barius
tried, still the same error
from python-for-android.
@ParokshaX
sorry for the delay, here is the numpy library I compiled. have fun
https://drive.google.com/file/d/0B7iBG-Vnm4w1WmxVQS1JREwtRzQ/edit?usp=sharing
from python-for-android.
@barius
Thanks.
anyway, I found the problem and fixed it, built numpy. :-D
but runtime error as opencv requires numpy API 9 (V 1.8.1) but the numpy python-for-android built is API 7 (V 1.7.1). u seem to have used numpy 1.7.1 did opencv work?
currently I am creating a patch for numpy-1.8.1 to build for android.
from python-for-android.
@ParokshaX
It worked like a charm :P
As long as major interfaces are the same between numpy 1.7.1 and 1.8.1 the interop between OpenCV and numpy could be stable, I guess :P
from python-for-android.
@barius weird!,
Runtime Error: Module is built for API 9 but the version of numpy is 7
while importing cv2,
I patched the numpy-1.8.1 and have built one, let me check and report
On 7/25/14, barius [email protected] wrote:
@ParokshaX
It worked like a charm :P
As long as major interfaces are the same between numpy 1.7.1 and 1.8.1 the
interop between OpenCV and numpy could be stable, I guess :P
Reply to this email directly or view it on GitHub:
#75 (comment)
from python-for-android.
@ParokshaX
FYI I used OpenCV 2.4.7 with numpy 1.7.1, and they work fine. Really weird.
from python-for-android.
I patched the numpy1.8.1 for python-for-android, now I have a working
opencv in my android :-D
On 7/25/14, barius [email protected] wrote:
@ParokshaX
FYI I used OpenCV 2.4.7 with numpy 1.7.1, and they work fine. Really weird.
Reply to this email directly or view it on GitHub:
#75 (comment)
from python-for-android.
@ParokshaX
congratz :D
hope we can get an official OpenCV from P4A :P
from python-for-android.
I have a plan of writing a recipe for it, not now, currently I am
quite overwhelmed by others ;-)
On 7/25/14, barius [email protected] wrote:
@ParokshaX
congratz :D
hope we can get an official OpenCV from P4A :P
Reply to this email directly or view it on GitHub:
#75 (comment)
from python-for-android.
Has there been any update on this? Would it be possible to get an official recipe for OpenCV in the near future? I would be extremely grateful! Coffees, all around!
from python-for-android.
I created a recipe for OpenCV and submitted it as PR #327. The recipe patches OpenCV v2.4.10.1, builds a fully working Python module cv2.so, as well as installs native camera libraries. The Java library (libopencv_java.so) is actually not needed.
I don't have the resource to test the camera functionality on many different devices. It works fine on one phone running Android 4.1, but failed on another phone running 4.4 (as @barius mentioned earlier).
from python-for-android.
Hi again, Jason. Do you have any tips for using the Android camera feature of OpenCV within kivy? This seems to be uncharted territory.
from python-for-android.
@jasonxunxu thank you very much for the recipe! Do you mind giving a small example on how one would use the camera? If it should be as simple as
cap = cv2.VideoCapture(0)
it might just not work on my nexus 5. This is the whole code i used to test: https://gist.github.com/cbenhagen/457af62752fba44fff47
from python-for-android.
oh never mind.. i just found your kivy fork and its camera-android branch
from python-for-android.
@cbenhagen Thanks for digging out my branch, I just posted a PR for Kivy. Please let me know how it works for you.
@gorgonaut04 I hope it does the trick for you too.
from python-for-android.
@jasonxunxu it looks to me as if this code is good for streaming video data, but can it also be used to actually take full-resolution photo using the shutter? I apologize if I'm just completely missing this, but are there any usage examples for this code? Thanks!
from python-for-android.
It is a standard camera provider so works transparently with the Camera widget on Android. In addition it has a read_frame
method to fetch current frame data (of same resolution as the preview image). It is not designed to take full resolution pictures, for which Plyer camera might be what you want.
from python-for-android.
Related Issues (20)
- Recipe for SpaCy HOT 1
- com.android.build.gradle.internal.tasks.CompressAssetsWorkAction: Java heap space HOT 1
- How to build a pyside6 project into an apk HOT 1
- push notification for android? need permission ACTION_APP_NOTIFICATION_SETTINGS HOT 2
- Didn't find class "org.kivy.android.PythonActivity$PermissionsCallback" HOT 1
- Questions about Copilot + Open Source Software Hierarchy
- Reportlab recipe HOT 2
- ask HOT 1
- please add uvloop to recipes! HOT 1
- Recipe for mediapipe required to execute python code on android HOT 2
- OpenJDK 11 incompatibility beacuse of Gradle 8.x / cannot build apk on WSL v1 HOT 4
- Add a recipe for `orjson` HOT 3
- Mock assertion issue with ICU recipe under Python 3.12 HOT 3
- Fix screen orientation of PythonActivity.java
- Add the recipe for jsonrpcserver module
- #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
- error: command '/home/lumina/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1 HOT 2
- Add the recipe for yt-dlp module
- Add recipe `pyreqwest_impersonate` HOT 27
- :rocket: Action plan for hosting prebuilt wheels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-for-android.