Skip to content

Recipe for OpenCV #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 4, 2015
Merged

Recipe for OpenCV #327

merged 4 commits into from
Mar 4, 2015

Conversation

jxai
Copy link
Contributor

@jxai jxai commented Feb 11, 2015

This is a fully working recipe for OpenCV (v2.4.10.1). The recipe automatically builds OpenCV Python module (cv2.so) and installs native camera libraries. This recipe attempts to fix #75.

@jxai jxai mentioned this pull request Feb 11, 2015
@gorgonaut04
Copy link

Well this is exciting, looking forward to trying it!

@gorgonaut04
Copy link

Hi Jason, I tried adding the new opencv recipe folder to my kivy linux virtual machine. When building my app with the "buildozer android debug" command, using the packages "numpy,opencv,kivy" in buildozer.spec, I get the error (paraphrasing because I don't have it in front of me):
"command failed: pip install [some_path] [another_path] opencv"

Obviously, pip shouldn't be used in order to generate the opencv lib, since it's not a listed package. Any suggestions/tips on how I can include this recipe before your pull request is accepted?

@jxai
Copy link
Contributor Author

jxai commented Feb 17, 2015

That's strange, when a recipe exists pip should not be activated to install that package, can you run:
buildozer -v android debug
and paste the log somewhere?

Also, did you set the android.p4a_dir option in your buildozer.spec file to point to your local directory of python-for-android?

@gorgonaut04
Copy link

I was suspicious of what directory is being used. I will investigate this, but it might be a couple days. This would certainly seem to explain the issue. Thanks for the response!

@gorgonaut04
Copy link

The directory was indeed incorrect (pointing to default) I added the new OpenCV recipe folder to the /home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/ path, ran it again, and got:
Read plyer recipe
Module plyer depend on pyjnius android
Read numpy recipe
Module numpy depend on python
Read opencv recipe
/home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/opencv/recipe.sh: line 2: $'\r': command not found
/home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/opencv/recipe.sh: line 5: $'\r': command not found
/home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/opencv/recipe.sh: line 10: $'\r': command not found
/home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/opencv/recipe.sh: line 14: $'\r': command not found
/home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/opencv/recipe.sh: line 15: syntax error near unexpected token $'{\r'' /home/kivy/buildozer/.buildozer/android/platform/python-for-android/recipes/open'v/recipe.sh: line 15:function prebuild_opencv() {
Module opencv depend on (numpy python)
Read kivy recipe
Module kivy depend on pygame pyjnius android
Read pyjnius recipe
Module pyjnius depend on python sdl
Read android recipe
Module android depend on pygame
Read python recipe
Module python depend on hostpython
Read (numpy recipe
Recipe (numpy does not exist, adding the module as pure-python package
recipethon)
does not exist, adding the module as pure-python package
Read pygame recipe
Module pygame depend on python sdl
Ignored pyjnius, already processed
Ignored android, already processed
Ignored python, already processed
Read sdl recipe
Module sdl depend on python
Ignored pygame, already processed
Read hostpython recipe
Ignored python, already processed
Ignored sdl, already processed
Ignored python, already processed
Modules changed to (numpy hostpython python) opencv python numpy sdl pygame pyjnius android kivy plyer
Pure-Python modules changed to (numpy python)
Run get packages
./distribute.sh: eval: line 534: syntax error near unexpected token (' ./distribute.sh: eval: line 534:echo $P4A_(numpy_DIR'
Download package for (numpy
No package for (numpy
Download package for hostpython
Module hostpython already downloaded
./distribute.sh: eval: line 534: syntax error near unexpected token )' ./distribute.sh: eval: line 534:echo $P4A_python)_DIR'
Download package for python)
No package for python)
Download package for opencv
.ziploading https://github.com/Itseez/opencv/archive/2.4.10.1
--2015-02-21 02:08:27-- https://github.com/Itseez/opencv/archive/2.4.10.1%0D.zip%0D
Resolving github.com (github.com)... 192.30.252.128
Connecting to github.com (github.com)|192.30.252.128|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2015-02-21 02:08:28 ERROR 404: Not Found.

@jxai
Copy link
Contributor Author

jxai commented Feb 22, 2015

I suggest to do the following:

  1. Check out my p4a fork directly instead of copying the opencv recipe out of it to avoid encoding problems.
  2. Use p4a directly without buildozer, it will simply things and let you know whether p4a works fine itself.

@gorgonaut04
Copy link

using your p4a fork worked! It has built, now to see how it works compared to my PC kivy app! PIL had some problematic filter differences, so we'll see!

@gorgonaut04
Copy link

Okay, it's working great! I have questions if you're willing to share how you used the android camera feature, but I'll save those for the the other thread about OpenCV support

@tito
Copy link
Member

tito commented Mar 4, 2015

That's neat!!!

tito added a commit that referenced this pull request Mar 4, 2015
@tito tito merged commit cc5f4c2 into kivy:master Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Camera on android
4 participants