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
{{ message }}
Repository navigation
Does the opencv recipe for buildozer not include the extra face class? #2166
If the face class (which is now part of the opencv-contrib-python module) is not included in the opencv recipe (which it doesn't seem to be), would it be too problematic to import it?
Look, listen. I really need to know how difficult it would be to import a few extra contrib modules through Python-For-Android.. would I need to try to make a new recipe for them? (This is important), I have an app that mostly uses PIP and other Libraries, but only 10 lines of code are dedicated to actually extracting the facial landmarks through opencv. I have put a lot of work into this app and I don't want to waste all my effort
This is how to make a local copy of an existing recipe in order to modify it.
Making new recpies for packages that are not pure Python is not somthing I can help with.
Replace RECIPE_NAME with whatever recipe you are changing:
in buildozer.spec change this
#p4a.local_recipes =
to
p4a.local_recipes = ./p4a-recipes
Thankyou for your help,
I am very grateful you took the time,
I've already changed the OpenCV recipe but libopencv_face.so doesn't get built (there is no patch disabling the face class I suspect), but I'm still missing something
Ok, I have made the changes but it seems to crash when applying the patch. I have created the following directories
.p4a-recipes/opencv_contrib which contains the subdirectory containing the patch(p4a_build.patch)
The structure is as follows:
.p4a-recipes/opencv_contrib/init.py
.p4a-recipes/opencv_contrib/patches/p4a_build.patch
.p4a-recipes/opencv_contrib/pycache/ (etc..)
I just cut and pasted the whole tree from GitHub (using develop).
Here is my buildozer spec (only including relevant areas):
(str) The directory in which python-for-android should look for your own build recipes (if any)
p4a.local_recipes = ./p4a-recipes
===============================================================
I get the following from the buildozer error log:
[INFO]: Applying patches for opencv_contrib[armeabi-v7a]
[INFO]: Applying patch patches/p4a_build.patch
[INFO]: -> running patch -t -d /mnt/c/users/nicholas/documents/f_con2/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/op...(and 151 more)
Exception in thread background thread for pid 13560:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
STDOUT:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|This patch allow that the opencv's build command correctly detects our version
|of python, so we can successfully build the python bindings (cv2.so)
|--- opencv-4.0.1/cmake/OpenCVDetectPython.cmake.orig 2018-12-22 08:03:30.000000000 +0100
|+++ opencv-4.0.1/cmake/OpenCVDetectPython.cmake 2019-01-31 11:33:10.896502978 +0100
No file to patch. Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 25
Perhaps you used the wrong -p or --strip option?
@SonofPoseidon1982 are you able to solve the issue?
I am facing the same error while tracing via logcat I get AttributeError; cv2.face
Can you please help me?
I need more information; what are you trying to do? If you are trying to use the face class you need import more than just the opencv recipe, but the extra classes which there now exists a recipe. Include opencv_extras in your list of buildozer recipes. The opencv extra classes were added to this recipe only last year.
Activity
SonofPoseidon1982 commentedon May 2, 2020
Do I have to edit the opencv recipe?
SonofPoseidon1982 commentedon May 5, 2020
Look, listen. I really need to know how difficult it would be to import a few extra contrib modules through Python-For-Android.. would I need to try to make a new recipe for them? (This is important), I have an app that mostly uses PIP and other Libraries, but only 10 lines of code are dedicated to actually extracting the facial landmarks through opencv. I have put a lot of work into this app and I don't want to waste all my effort
RobertFlatt commentedon May 16, 2020
This is how to make a local copy of an existing recipe in order to modify it.
Making new recpies for packages that are not pure Python is not somthing I can help with.
Replace RECIPE_NAME with whatever recipe you are changing:
in buildozer.spec change this
#p4a.local_recipes =
to
p4a.local_recipes = ./p4a-recipes
create directories
./p4a-recipes
./p4a-recipes/RECIPE_NAME
copy and paste the files from
https://github.com/kivy/python-for-android/tree/develop/pythonforandroid/recipes/RECIPE_NAME
( Note using 'develop' to get latest fixes)
Change the files in a way that makes you happy (and beware of breaking patch files).
buildozer android clean
buildozer android debug
SonofPoseidon1982 commentedon May 16, 2020
Thankyou for your help,
I am very grateful you took the time,
I've already changed the OpenCV recipe but libopencv_face.so doesn't get built (there is no patch disabling the face class I suspect), but I'm still missing something
SonofPoseidon1982 commentedon May 17, 2020
Ok, I have made the changes but it seems to crash when applying the patch. I have created the following directories
.p4a-recipes/opencv_contrib which contains the subdirectory containing the patch(p4a_build.patch)
The structure is as follows:
.p4a-recipes/opencv_contrib/init.py
.p4a-recipes/opencv_contrib/patches/p4a_build.patch
.p4a-recipes/opencv_contrib/pycache/ (etc..)
I just cut and pasted the whole tree from GitHub (using develop).
Here is my buildozer spec (only including relevant areas):
===============================================================
(list) Application requirements
comma separated e.g. requirements = sqlite3,kivy
requirements = python3, kivy, numpy, scipy, Pillow, selenium, urllib3, appium-python-client, jnius, kivmob, android, hostpython3, xcamera, plyer, opencv_contrib
(str) The directory in which python-for-android should look for your own build recipes (if any)
p4a.local_recipes = ./p4a-recipes
===============================================================
I get the following from the buildozer error log:
[INFO]: Applying patches for opencv_contrib[armeabi-v7a]
[INFO]: Applying patch patches/p4a_build.patch
[INFO]: -> running patch -t -d /mnt/c/users/nicholas/documents/f_con2/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/op...(and 151 more)
Exception in thread background thread for pid 13560:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 1540, in wrap
fn(*args, **kwargs)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 2459, in background_thread
handle_exit_code(exit_code)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 2157, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/nloizou/.local/lib/python3.6/site-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /usr/bin/patch -t -d /mnt/c/users/nicholas/documents/f_con2/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/opencv_contrib/armeabi-v7a__ndk_target_21/opencv_contrib -p1 -i /mnt/c/users/nicholas/documents/f_con2/p4a-recipes/opencv_contrib/patches/p4a_build.patch
STDOUT:
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|This patch allow that the opencv's build command correctly detects our version
|of python, so we can successfully build the python bindings (cv2.so)
|--- opencv-4.0.1/cmake/OpenCVDetectPython.cmake.orig 2018-12-22 08:03:30.000000000 +0100
|+++ opencv-4.0.1/cmake/OpenCVDetectPython.cmake 2019-01-31 11:33:10.896502978 +0100
No file to patch. Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 25
Perhaps you used the wrong -p or --strip option?
SonofPoseidon1982 commentedon May 17, 2020
oh its ok, I renamed the recipe /opencv and its ok, but it still doesn't build libopencv_face.so
abhishekju06 commentedon Jan 16, 2021
@SonofPoseidon1982 are you able to solve the issue?
I am facing the same error while tracing via logcat I get AttributeError; cv2.face
Can you please help me?
SonofPoseidon1982 commentedon Jan 18, 2021
I need more information; what are you trying to do? If you are trying to use the face class you need import more than just the opencv recipe, but the extra classes which there now exists a recipe. Include opencv_extras in your list of buildozer recipes. The opencv extra classes were added to this recipe only last year.
SonofPoseidon1982 commentedon Jan 18, 2021
I requested this last year and I had a part to play in testing it (at least superficially). https://github.com/kivy/python-for-android/tree/master/pythonforandroid/recipes/opencv_extras