Skip to content
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

Rework opencv's recipe (enable cv2.so and the extra opencv libraries) #1661

Merged
merged 3 commits into from
Feb 5, 2019

Conversation

opacam
Copy link
Member

@opacam opacam commented Feb 2, 2019

We enable the build of the cv2.so library to be able to interact with opencv from python and also we enable the build of most of the opencv's libraries or we will not be able to perform operation with videos, photos, images and others.

Tested in a device with python2 and python3 modifying the testapp_sqlite_openssl with:

    def test_numpy(self, *args):
        import numpy

        print(numpy.zeros(5))
        print(numpy.arange(5))
        print(numpy.random.random((3, 3)))
        print('ok imported numpy...testing cv2...')
        import cv2
        print('ok imported cv2...testing image open...')

        # Load an color image in grayscale
        img = cv2.imread('colours.png', 0)
        print(img)

Producing the following result with adb logcat:

02-02 18:50:43.857  1752  1932 I python  : App print tick 10.643630340993695
02-02 18:50:43.935  1752  1932 I python  : touched at (1280.3331756591797, 1071.4893925189972)
02-02 18:50:44.167  1752  1932 I python  : [0. 0. 0. 0. 0.]
02-02 18:50:44.168  1752  1932 I python  : [0 1 2 3 4]
02-02 18:50:44.169  1752  1932 I python  : [[0.93794488 0.90300461 0.48235631]
02-02 18:50:44.169  1752  1932 I python  :  [0.31897204 0.79382141 0.83574916]
02-02 18:50:44.169  1752  1932 I python  :  [0.41996952 0.01379619 0.10851758]]
02-02 18:50:44.169  1752  1932 I python  : ok imported numpy...testing cv2...
02-02 18:50:44.253  1752  1932 I python  : ok imported cv2...testing image open...
02-02 18:50:44.266  1752  1932 I python  : [[ 27  27  27 ...  95  95  94]
02-02 18:50:44.266  1752  1932 I python  :  [ 27  26  27 ...  95  95  95]
02-02 18:50:44.266  1752  1932 I python  :  [ 27  26  27 ...  94  95  95]
02-02 18:50:44.266  1752  1932 I python  :  ...
02-02 18:50:44.266  1752  1932 I python  :  [126 127 127 ... 168 169 170]
02-02 18:50:44.266  1752  1932 I python  :  [126 128 128 ... 169 170 170]
02-02 18:50:44.267  1752  1932 I python  :  [127 128 129 ... 170 170 171]]

Note: this pr completes the work started by @AndreMiras in #1650

We enable the build of the cv2.so library to be able to interact with opencv from python and also we enable the build of most of the opencv's libraries or we will not be able to perform operation with videos, photos, images and others.
@AndreMiras
Copy link
Member

Nice work @opacam!
Two questions:

  1. do we "absolutely need" all the libraries you've enabled?
  2. can you re-add opencv to the broken list ci/constants.py?

The build seem to run for ages and fails with:

           working: -- Build files have been written to: /home/user/.local/share/...(and 84 more)  �[0m
                                                                                                   
stty: 'standard input': Inappropriate ioctl for device


No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received

The build has been terminated

In the broken recipe list, you could also add a comment explaining that it's not actually broken, but the CI fail to compile to the end (timeout) and you can link this build https://travis-ci.org/kivy/python-for-android/jobs/487920951
But probably compiling less libs could also fix it. Just I'm not sure if they're all that needed or not.

What do you think?

@opacam
Copy link
Member Author

opacam commented Feb 3, 2019

do we "absolutely need" all the libraries you've enabled?

Well, I think that it depends on the target app and the use who mades of opencv in there, so more libraries will grant more compatibility with different types of objects...mmm...I tried to disable some of them (libopencv_flann) and the cv2.so failed to be build. The library that we could safely remove is libopencv_highgui.so and disable the opencv_java_bindings_generator but I don't think that will be enough to successfully pass the travis tests (mmm ...despite this recipe takes a while to be build I don't think that the problem is the processing...there is something else going on that I'm not be able to see for now...)

can you re-add opencv to the broken list ci/constants.py?

Of course, if we don't find a solution for this travis error I will do it

@opacam
Copy link
Member Author

opacam commented Feb 3, 2019

Ok, I made a test in a parallel branch with a debug build (disabling all tests except the rebuild_updated_recipes and disabling the libs/modules I mentioned above):

I think you are right @AndreMiras, too much processing and because we suppress some logs in the standard build the inactivity in logs cause travis to fail...🤔

@AndreMiras
Copy link
Member

Thanks for investigating further! Well then let's just add it to the list of recipe to skip. Just make it clear with a comment, maybe linking to this PR that it fails because of Travis timeout

@opacam
Copy link
Member Author

opacam commented Feb 3, 2019

Let me try something that can solve the travis problem, I'm trying right now (in other branch)...if not working I will add it to the list of recipe to skip...so...please...don't merge this...wait

Because we probably don't need that. Also add a commented line to disable `opencv_highgui` (we can safely build the cv2.so without it)

¡¡¡Thanks @AndreMiras!!!
Copy link
Member

@AndreMiras AndreMiras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@SonofPoseidon1982
Copy link

How difficult would it be to include and enable libopencv_face.so?

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.

3 participants