kivy opencv android

0

I'm trying to build an apk with an application that works perfectly on my PC but when I pass it to the tablet it installs it correctly and when I want to execute it I get the error that the application stopped. I built the apk with a buildozer and there I think the problem may be, the application is as follows:

from kivy.app import App
from kivy.uix.image import Image
from kivy.clock import Clock
from kivy.graphics.texture import Texture
import cv2 
from kivy.uix.camera import Camera 

class KivyCamera(Image):
    def __init__(self, capture, fps, **kwargs):
         super(KivyCamera, self).__init__(**kwargs)
         self.capture = capture
         Clock.schedule_interval(self.update, 1.0 / fps)

    def update(self, dt):
         ret, frame = self.capture.read()
         if ret:
            # convert it to texture
            buf1 = cv2.flip(frame, 0)
            buf = buf1.tostring()
            image_texture = Texture.create(size=(frame.shape[1], frame.shape[0]), colorfmt='bgr')
            image_texture.blit_buffer(buf, colorfmt='bgr', bufferfmt='ubyte')
            # display image from the texture
            self.texture = image_texture


class CamApp(App):
    def build(self):
        self.capture = cv2.VideoCapture(0)
        self.my_camera = KivyCamera(capture=self.capture, fps=30)
        return self.my_camera

    def on_stop(self):
        #without this, app will not exit even if the window is closed
        self.capture.release()

if __name__ == '__main__':
    CamApp().run()

Regarding the file buildozer.speec:

source.include_exts = py,png,jpg,kv,atlas
requirements = kivy, numpy, opencv
orientation = landscape
osx.python_version = 3
osx.kivy_version = 1.9.1
android.permissions = CAMERA
android.permission-group = HARDWARE_CONTROLS

When I run it on the tablet via logcat in the long console the following error:

E/Corkscrew(  196): update_state: unexpected CFA register: 7
E/Corkscrew(  196): update_state: unexpected CFA register: 7
I/BootReceiver(  511): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
E/JavaBinder(  511): !!! FAILED BINDER TRANSACTION !!!
W/ActivityManager(  511):   Force finishing activity org.test.opencv/org.kivy.android.PythonActivity
W/ufoGralloc(  197): registerBuffer() handle 0xf942b590/9 didn't require registration
E/JavaBinder(  511): !!! FAILED BINDER TRANSACTION !!!
W/ActivityManager(  511): Exception thrown during pause
W/ActivityManager(  511): android.os.TransactionTooLargeException
W/ActivityManager(  511):   at android.os.BinderProxy.transact(Native Method)
W/ActivityManager(  511):   at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:667)
W/ActivityManager(  511):   at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:781)
W/ActivityManager(  511):   at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2489)
W/ActivityManager(  511):   at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2366)
W/ActivityManager(  511):   at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2147)
W/ActivityManager(  511):   at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:9762)
W/ActivityManager(  511):   at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:9655)
W/ActivityManager(  511):   at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:10326)
W/ActivityManager(  511):   at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:9851)
W/ActivityManager(  511):   at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
I/WindowState(  511): WIN DEATH: Window{26d51f00 u0 org.test.opencv/org.kivy.android.PythonActivity}
D/Zygote  (  198): Process 6116 terminated by signal (11)
I/WindowState(  511): WIN DEATH: Window{26d7ad30 u0 SurfaceView}
I/ActivityManager(  511): Process org.test.opencv (pid 6116) has died.
I/SecurityManagerService(  612): SMS received security event: App[STOP/org.test.opencv]
D/InputMethodManagerService(  511): --- calledFromForegroundUserOrSystemProcess ? calling uid = 1000 system uid = 1000 calling userId = 0, foreground user id = 0, calling pid = 511dalvik.system.NativeStart.run(Native Method)
D/        (  764): Pixel Format : GGL_PIXEL_FORMAT_RGBA_8888
W/UdcContextManagerHelper(  722): Empty context buffer. Thus might mean that the context is not synced down.
W/GetDeviceDataUploadOptInStatusOp(  722): Empty context model while retrieving upload opt-in status!
W/Conscrypt(  851): Could not set socket write timeout:
W/Conscrypt(  851):    java.lang.reflect.Method.invokeNative(Native Method)
W/Conscrypt(  851):    java.lang.reflect.Method.invoke(Method.java:515)
W/Conscrypt(  851): Could not set socket write timeout:
W/Conscrypt(  851):    java.lang.reflect.Method.invokeNative(Native Method)
W/Conscrypt(  851):    java.lang.reflect.Method.invoke(Method.java:515)

I suspect that it may become something of the resolution of the screen but I would not know how to solve it.

    
asked by Martin Bucarey 30.08.2017 в 14:07
source

0 answers