OpenCV se bloquea después de un corto período de tiempo en la aplicación para Android

Tengo una aplicación que realiza una cierta costura de imagen y utiliza OpenCV. Solía ​​trabajar pero de repente se bloquea (al azar?) Todo el tiempo. No sé por qué sucede esto, no cambié el código, pero tampoco probé esa característica durante varias semanas. Hubo probablemente una actualización de Android en el ínterin en mi Nvidia Shield.

Solía ​​trabajar con OpenCV 2.4.10, pero como ya no funcionaba con esa versión, he intentado cambiar a OpenCV 3.0.0 que muestra el mismo comportamiento.

Mi configuración:

  • Nvidia Shield con Android 5.1.1
  • OpenCV_3.0.0_manager_3.00_armeabi-v7a.apk instalado OpenCV_3.0.0_manager_3.00_armeabi-v7a.apk
  • El objetivo de la compilación es Android 5.1.1
  • Biblioteca OpenCV 3.0 integrada desde el SDK de Android en mi proyecto de Android. Dentro del SDK, esta es la ruta a la biblioteca: %path-to-sdk%/OpenCV3-android-sdk/sdk/java

Mi aplicación se comporta de la siguiente manera: Parece que con éxito cargar e inicializar OpenCV e incluso comienza a capturar y coser algunas imágenes. Después de tres o cuatro imágenes, se bloquea. Estos son los registros de Android que se registran durante el bloqueo:

 02-01 13:07:55.172: I/AudioFlinger(209): AUDIO_OUTPUT_FLAG_FAST accepted: frameCount=11258 mFrameCount=512 02-01 13:07:55.321: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:07:55.582: E/Error(209): configureSensor: cannot find a sensor mode for 2592x1944 02-01 13:07:56.391: W/Camera2-ZslProcessor3(209): getCandidateTimestampLocked: ZSL queue has no metadata frames 02-01 13:07:56.391: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:07:56.653: E/Error(209): configureSensor: cannot find a sensor mode for 2592x1944 02-01 13:07:56.745: I/ActivityManager(632): Process com.google.android.partnersetup (pid 22851) has died 02-01 13:07:57.301: W/Camera2-ZslProcessor3(209): getCandidateTimestampLocked: ZSL queue has no metadata frames 02-01 13:07:57.301: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:07:57.640: E/Error(209): configureSensor: cannot find a sensor mode for 2592x1944 02-01 13:07:58.134: I/ActivityManager(632): Process com.google.android.calendar (pid 23255) has died 02-01 13:07:58.139: E/lowmemorykiller(174): Error writing /proc/22747/oom_score_adj; errno=22 02-01 13:07:58.146: I/BackgroundMemoryTrimmer(22823): Trimming objects from memory, since app is in the background. 02-01 13:07:58.173: I/PersonalGridService(22885): onTrimMemory called with level: 5 02-01 13:07:58.174: I/ActivityManager(632): Process android.process.acore (pid 22747) has died 02-01 13:07:58.271: W/Camera2-ZslProcessor3(209): getCandidateTimestampLocked: ZSL queue has no metadata frames 02-01 13:07:58.271: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:07:58.322: I/ActivityManager(632): Process com.android.providers.calendar (pid 23231) has died 02-01 13:07:58.364: I/ActivityManager(632): Process com.google.android.apps.plus (pid 23125) has died 02-01 13:07:58.365: E/lowmemorykiller(174): Error writing /proc/23104/oom_score_adj; errno=22 02-01 13:07:58.369: I/PersonalGridService(22885): onTrimMemory called with level: 10 02-01 13:07:58.381: I/ActivityManager(632): Process com.android.chrome (pid 23104) has died 02-01 13:07:58.400: I/ActivityManager(632): Process com.google.android.apps.photos (pid 23029) has died 02-01 13:07:58.407: I/PersonalGridService(22885): onTrimMemory called with level: 15 02-01 13:07:58.432: I/ActivityManager(632): Process com.google.process.gapps (pid 22637) has died 02-01 13:07:58.433: E/lowmemorykiller(174): Error opening /proc/22823/oom_score_adj; errno=2 02-01 13:07:58.434: I/ActivityManager(632): Process com.google.android.googlequicksearchbox:search (pid 22823) has died 02-01 13:07:58.566: E/Error(209): configureSensor: cannot find a sensor mode for 2592x1944 02-01 13:07:58.608: I/ActivityManager(632): Process org.opencv.engine:OpenCVEngineProcess (pid 22529) has died 02-01 13:07:59.175: W/Camera2-ZslProcessor3(209): getCandidateTimestampLocked: ZSL queue has no metadata frames 02-01 13:07:59.175: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:07:59.277: I/ActivityManager(632): Process com.google.android.talk (pid 22787) has died 02-01 13:07:59.277: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.talk/com.google.android.libraries.hangouts.video.CallService in 1000ms 02-01 13:07:59.280: I/ActivityManager(632): Process android.process.media (pid 22454) has died 02-01 13:07:59.280: W/ActivityManager(632): Scheduling restart of crashed service com.android.providers.media/.MtpService in 1000ms 02-01 13:07:59.291: I/ActivityManager(632): Process com.nvidia.penapplauncher (pid 22972) has died 02-01 13:07:59.291: W/ActivityManager(632): Scheduling restart of crashed service com.nvidia.penapplauncher/com.nvidia.quickMenu.QuickMenuService in 10988ms 02-01 13:07:59.365: I/ActivityManager(632): Process com.nvidia.tegrazone3 (pid 22477) has died 02-01 13:07:59.365: W/ActivityManager(632): Scheduling restart of crashed service com.nvidia.tegrazone3/com.nvidia.tegrazone.account.AccountService in 20915ms 02-01 13:07:59.365: E/lowmemorykiller(174): Error opening /proc/22616/oom_score_adj; errno=2 02-01 13:07:59.366: I/ActivityManager(632): Process com.google.android.gms (pid 22616) has died 02-01 13:07:59.366: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/.analytics.service.AnalyticsService in 30914ms 02-01 13:07:59.441: E/Error(209): configureSensor: cannot find a sensor mode for 2592x1944 02-01 13:07:59.510: I/ActivityManager(632): Start proc 23500:com.nvidia.tegrazone3/u0a65 for service com.nvidia.tegrazone3/com.nvidia.tegrazone.account.AccountService 02-01 13:07:59.671: I/ActivityManager(632): Process com.nvidia.tegrazone3:PersonalGridService (pid 22885) has died 02-01 13:07:59.671: W/ActivityManager(632): Scheduling restart of crashed service com.nvidia.tegrazone3/com.nvidia.grid.PersonalGridService.pgService in 20609ms 02-01 13:07:59.966: W/Camera2-ZslProcessor3(209): getCandidateTimestampLocked: ZSL queue has no metadata frames 02-01 13:07:59.966: E/Camera2-ZslProcessor3(209): pushToReprocess: Could not find good candidate for ZSL reprocessing 02-01 13:08:00.020: I/ActivityManager(632): Process com.google.android.inputmethod.latin (pid 22923) has died 02-01 13:08:00.020: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME in 30260ms 02-01 13:08:00.100: I/ActivityManager(632): Process com.google.android.gms.persistent (pid 22659) has died 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.internal.PendingIntentCallbackService in 40180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/.common.stats.GmsCoreStatsService in 50180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/.backup.BackupTransportService in 60180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.fused.FusedLocationService in 70180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/.deviceconnection.service.DeviceConnectionServiceBroker in 80180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.network.NetworkLocationService in 90180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.geofencer.service.GeofenceProviderService in 100180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/.gcm.GcmService in 110180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.geocode.GeocodeService in 120180ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.internal.GoogleLocationManagerService in 130179ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.internal.server.GoogleLocationService in 140179ms 02-01 13:08:00.100: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.contextmanager.service.ContextManagerService in 150179ms 02-01 13:08:00.101: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.gms/com.google.android.location.reporting.service.DispatchingService in 160179ms 02-01 13:08:00.116: I/WindowState(632): WIN DEATH: Window{1026bdfe u0 com.nvidia.ControllerMapper} 02-01 13:08:00.341: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.343: W/InputDispatcher(632): channel '3438de7d mobileBRDF.Renderer/mobileBRDF.ImageProcessing.ImageProcessingActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 02-01 13:08:00.343: E/InputDispatcher(632): channel '3438de7d mobileBRDF.Renderer/mobileBRDF.ImageProcessing.ImageProcessingActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 02-01 13:08:00.378: W/CameraService(209): Disconnecting camera client 0xae447290 since the binder for it died (this pid 209) 02-01 13:08:00.379: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.379: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.379: E/Camera3-OutputStream(209): getBufferLocked: Stream 0: Can't dequeue next output buffer: Broken pipe (-32) 02-01 13:08:00.379: E/Camera3-Device(209): RequestThread: Can't get output buffer, skipping request: Broken pipe (-32) 02-01 13:08:00.379: E/Camera2ClientBase(209): Error condition 3 reported by HAL, requestId 30000005 02-01 13:08:00.383: W/InputDispatcher(632): channel '24b71005 mobileBRDF.Renderer/mobileBRDF.HDR.EnvMapCaptureActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 02-01 13:08:00.383: E/InputDispatcher(632): channel '24b71005 mobileBRDF.Renderer/mobileBRDF.HDR.EnvMapCaptureActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 02-01 13:08:00.396: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.396: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.396: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.415: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.415: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.415: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.431: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.431: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.431: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.518: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.518: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.518: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.571: E/Surface(209): queueBuffer: error queuing buffer to SurfaceTexture, -32 02-01 13:08:00.571: E/Camera3-OutputStream(209): returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32) 02-01 13:08:00.571: E/Camera3-Device(209): Can't return buffer to its stream: Broken pipe (-32) 02-01 13:08:00.610: I/WindowState(632): WIN DEATH: Window{2fbeaa8b u0 SurfaceView} 02-01 13:08:00.844: I/WindowState(632): WIN DEATH: Window{24b71005 u0 mobileBRDF.Renderer/mobileBRDF.HDR.EnvMapCaptureActivity} 02-01 13:08:00.844: W/InputDispatcher(632): Attempted to unregister already unregistered input channel '24b71005 mobileBRDF.Renderer/mobileBRDF.HDR.EnvMapCaptureActivity (server)' 02-01 13:08:00.912: I/WindowState(632): WIN DEATH: Window{3438de7d u0 mobileBRDF.Renderer/mobileBRDF.ImageProcessing.ImageProcessingActivity} 02-01 13:08:00.912: W/InputDispatcher(632): Attempted to unregister already unregistered input channel '3438de7d mobileBRDF.Renderer/mobileBRDF.ImageProcessing.ImageProcessingActivity (server)' 02-01 13:08:00.912: W/WindowManager(632): Force-removing child win Window{d2dcab1 u0 SurfaceView} from container Window{3438de7d u0 mobileBRDF.Renderer/mobileBRDF.ImageProcessing.ImageProcessingActivity} 02-01 13:08:00.953: W/WindowManager(632): Failed looking up window 02-01 13:08:00.953: W/WindowManager(632): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@821958 does not exist 02-01 13:08:00.953: W/WindowManager(632): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8559) 02-01 13:08:00.953: W/WindowManager(632): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:8550) 02-01 13:08:00.953: W/WindowManager(632): at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1142) 02-01 13:08:00.953: W/WindowManager(632): at android.os.BinderProxy.sendDeathNotice(Binder.java:551) 02-01 13:08:00.953: I/WindowState(632): WIN DEATH: null 02-01 13:08:00.955: I/ActivityManager(632): Process com.google.android.googlequicksearchbox:interactor (pid 23335) has died 02-01 13:08:00.955: W/ActivityManager(632): Scheduling restart of crashed service com.google.android.googlequicksearchbox/com.google.android.voiceinteraction.GsaVoiceInteractionService in 942128ms 02-01 13:08:00.956: I/ActivityManager(632): Process com.nvidia.ControllerMapper (pid 22589) has died 02-01 13:08:00.956: W/ActivityManager(632): Scheduling restart of crashed service com.nvidia.ControllerMapper/.MapperService in 159324ms 02-01 13:08:00.957: I/ActivityManager(632): Process com.nvidia.stats (pid 22508) has died 02-01 13:08:00.957: W/ActivityManager(632): Scheduling restart of crashed service com.nvidia.stats/.StatsService in 169323ms 02-01 13:08:00.983: W/InputMethodManagerService(632): Session failed to close due to remote exception 02-01 13:08:00.983: W/InputMethodManagerService(632): android.os.DeadObjectException 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.os.BinderProxy.transactNative(Native Method) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.os.BinderProxy.transact(Binder.java:496) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.internal.view.IInputMethodSession$Stub$Proxy.finishSession(IInputMethodSession.java:305) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.InputMethodManagerService.finishSessionLocked(InputMethodManagerService.java:1420) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.InputMethodManagerService.clearClientSessionLocked(InputMethodManagerService.java:1411) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.InputMethodManagerService.clearCurMethodLocked(InputMethodManagerService.java:1437) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.InputMethodManagerService.onServiceDisconnected(InputMethodManagerService.java:1456) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.app.LoadedApk$ServiceDispatcher.doDeath(LoadedApk.java:1213) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1227) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.os.Handler.handleCallback(Handler.java:739) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.os.Handler.dispatchMessage(Handler.java:95) 02-01 13:08:00.983: W/InputMethodManagerService(632): at android.os.Looper.loop(Looper.java:135) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.SystemServer.run(SystemServer.java:269) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.server.SystemServer.main(SystemServer.java:170) 02-01 13:08:00.983: W/InputMethodManagerService(632): at java.lang.reflect.Method.invoke(Native Method) 02-01 13:08:00.983: W/InputMethodManagerService(632): at java.lang.reflect.Method.invoke(Method.java:372) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 02-01 13:08:00.983: W/InputMethodManagerService(632): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 02-01 13:08:00.998: I/stats(632): onServiceDisconnected 02-01 13:08:00.998: I/stats(632): onServiceDisconnected 02-01 13:08:01.054: I/ActivityManager(632): Start proc 23521:android.process.media/u0a5 for service com.android.providers.media/.MtpService 02-01 13:08:01.057: I/ActivityManager(632): Process mobileBRDF.Renderer (pid 22471) has died 02-01 13:08:01.058: W/ActivityManager(632): Force removing ActivityRecord{1e7f649b u0 mobileBRDF.Renderer/mobileBRDF.HDR.EnvMapCaptureActivity t1990}: app died, no saved state 

¿Cuál podría ser la razón de este comportamiento?

¿Podría ser que he perdido algo durante la configuración? (Algo relacionado con el OpenCV manager tal vez?)

¿Alguna idea de lo que podría hacer para reducir el error?

Actualizar:

Todavía no he sido capaz de averiguar el problema en el Escudo Nvidia. Simplemente se bloquea en alguna parte dentro de OpenCV. Probado en 2 dispositivos Nvidia Shield diferentes => se bloquea en ambos. La misma compilación + la misma configuración se ejecuta sin estrellarse en el Nexus 9 de Google que tiene la misma GPU (Nvidia K1). Tiempos locos

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.