Git Product home page Git Product logo

Comments (30)

tito avatar tito commented on May 22, 2024

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.

alexsilva avatar alexsilva commented on May 22, 2024

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.

alexsilva avatar alexsilva commented on May 22, 2024

I disagree with this statement:

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.

tito avatar tito commented on May 22, 2024

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.

barius avatar barius commented on May 22, 2024

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.

venthur avatar venthur commented on May 22, 2024

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.

barius avatar barius commented on May 22, 2024

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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

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.

barius avatar barius commented on May 22, 2024

@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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

@barius
Thanks, I managed to build it by using opencv's cmake, however I have problem with the numpy recipe!

from python-for-android.

barius avatar barius commented on May 22, 2024

@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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

@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.

barius avatar barius commented on May 22, 2024

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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

@barius
tried, still the same error

from python-for-android.

barius avatar barius commented on May 22, 2024

@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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

@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.

barius avatar barius commented on May 22, 2024

@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.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

@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.

barius avatar barius commented on May 22, 2024

@ParokshaX
FYI I used OpenCV 2.4.7 with numpy 1.7.1, and they work fine. Really weird.

from python-for-android.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

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.

barius avatar barius commented on May 22, 2024

@ParokshaX
congratz :D
hope we can get an official OpenCV from P4A :P

from python-for-android.

AshokEmrys avatar AshokEmrys commented on May 22, 2024

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.

gorgonaut04 avatar gorgonaut04 commented on May 22, 2024

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.

jxai avatar jxai commented on May 22, 2024

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.

gorgonaut04 avatar gorgonaut04 commented on May 22, 2024

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.

cbenhagen avatar cbenhagen commented on May 22, 2024

@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.

cbenhagen avatar cbenhagen commented on May 22, 2024

oh never mind.. i just found your kivy fork and its camera-android branch

from python-for-android.

jxai avatar jxai commented on May 22, 2024

@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.

gorgonaut04 avatar gorgonaut04 commented on May 22, 2024

@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.

jxai avatar jxai commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.