You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
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.
@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.
@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.
@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?
try put numpy in front of kivy first 😁
2014-7-25 上午12:20于 "Ashok Kumar P (ParokshaX)" notifications@github.com写道:
@bariushttps://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)
.
@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
@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
@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)
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!
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).
@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!
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.
Activity
tito commentedon Dec 16, 2012
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.
alexsilva commentedon Dec 16, 2012
So if I only include "opencv" the process of compiling the camera will work?
Keep in mind that I started using "Kivy" very recently.
alexsilva commentedon Dec 16, 2012
I disagree with this statement:
I agree with the statement:
Ok, no problem.
tito commentedon Dec 16, 2012
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.
barius commentedon Mar 4, 2014
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.
venthur commentedon May 22, 2014
Do you mean you compiled the OpenCV Python library for arm/android using python-for-android? If yes, would you mind sharing the recipe?
barius commentedon May 23, 2014
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 notifications@github.com:
AshokEmrys commentedon Jul 23, 2014
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
barius commentedon Jul 24, 2014
@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
AshokEmrys commentedon Jul 24, 2014
@barius
Thanks, I managed to build it by using opencv's cmake, however I have problem with the numpy recipe!
barius commentedon Jul 24, 2014
@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.
AshokEmrys commentedon Jul 24, 2014
@barius
I used
./distribute.sh -m openssl pil kivy numpybut 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?
barius commentedon Jul 24, 2014
try put numpy in front of kivy first 😁
2014-7-25 上午12:20于 "Ashok Kumar P (ParokshaX)" notifications@github.com写道:
AshokEmrys commentedon Jul 24, 2014
@barius
tried, still the same error
barius commentedon Jul 25, 2014
@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
1 remaining item
barius commentedon Jul 25, 2014
@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
AshokEmrys commentedon Jul 25, 2014
@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 notifications@github.com wrote:
barius commentedon Jul 25, 2014
@ParokshaX
FYI I used OpenCV 2.4.7 with numpy 1.7.1, and they work fine. Really weird.
AshokEmrys commentedon Jul 25, 2014
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 notifications@github.com wrote:
barius commentedon Jul 25, 2014
@ParokshaX
congratz :D
hope we can get an official OpenCV from P4A :P
AshokEmrys commentedon Jul 25, 2014
I have a plan of writing a recipe for it, not now, currently I am
quite overwhelmed by others ;-)
On 7/25/14, barius notifications@github.com wrote:
gorgonaut04 commentedon Feb 1, 2015
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!
jxai commentedon Feb 11, 2015
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).
gorgonaut04 commentedon Feb 23, 2015
Hi again, Jason. Do you have any tips for using the Android camera feature of OpenCV within kivy? This seems to be uncharted territory.
cbenhagen commentedon Apr 4, 2015
@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
it might just not work on my nexus 5. This is the whole code i used to test: https://gist.github.com/cbenhagen/457af62752fba44fff47
cbenhagen commentedon Apr 4, 2015
oh never mind.. i just found your kivy fork and its camera-android branch
jxai commentedon Apr 5, 2015
@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.
gorgonaut04 commentedon Apr 6, 2015
@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!
jxai commentedon Apr 7, 2015
It is a standard camera provider so works transparently with the Camera widget on Android. In addition it has a
read_framemethod 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.