Question about CameraX library (Image Analysis Class)

395 views
Skip to first unread message

Giouri Kilinkaridis

unread,
Feb 15, 2021, 7:15:06 AM2/15/21
to camerax-d...@android.com

Hello,

 

My name is Giouri Kilinkaridis and I am a CS student at the Ionian University of Greece.

I am trying to make an app using an object detection algorithm to create a basic interface like talking pictures and viewing them with the use of gestures and in my android project I use the cameraX library to get access to the camera and the frames which I pass to the object detector (I use an external usb camera).  The problem that I came across is that the app works on android smartphones but when I installed android 9 on my raspberry pi 3 b+ for testing and run the app I get this error* . The camera freezes and reopens every 5 seconds but if I disable by commentating  the Image Analysis method and stop accessing the frames the app works I get a smooth preview with decent frame rate but without the ability to do object detection. I am wondering if that is a raspberry pi issue for example lack of gpu memory for processing and use of the Image Analysis class or something else went wrong. It would awesome if you could guide me finding a solution.

 

*

E/GraphicBufferAllocator: Failed to allocate (640 x 480) layerCount 1 format 35 usage 33: 3

E/BufferQueueProducer: [ImageReader-640x480f23m4-2280-0] dequeueBuffer: createGraphicBuffer failed

E/Legacy-CameraDevice-JNI: produceFrame: Failed to dequeue buffer, error Out of memory (-12).

    LegacyCameraDevice_nativeProduceFrame: Error while producing frame Out of memory (-12).

E/CameraDeviceGLThread-0: Received exception on GL render thread:

    java.lang.UnsupportedOperationException: Unknown error -12

        at android.hardware.camera2.legacy.LegacyExceptionUtils.throwOnError(LegacyExceptionUtils.java:77)

        at android.hardware.camera2.legacy.LegacyCameraDevice.produceFrame(LegacyCameraDevice.java:713)

        at android.hardware.camera2.legacy.SurfaceTextureRenderer.drawIntoSurfaces(SurfaceTextureRenderer.java:839)

        at android.hardware.camera2.legacy.GLThreadManager$1.handleMessage(GLThreadManager.java:105)

        at android.os.Handler.dispatchMessage(Handler.java:102)

        at android.os.Looper.loop(Looper.java:193)

        at android.os.HandlerThread.run(HandlerThread.java:65)

 

E/CameraCaptureSession: Session 0: Exception while stopping repeating:

    android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error

        at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2406)

        at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1104)

        at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526)

        at androidx.camera.camera2.internal.SynchronizedCaptureSessionBaseImpl.close(SynchronizedCaptureSessionBaseImpl.java:435)

        at androidx.camera.camera2.internal.SynchronizedCaptureSessionImpl.lambda$close$4$SynchronizedCaptureSessionImpl(SynchronizedCaptureSessionImpl.java:308)

        at androidx.camera.camera2.internal.-$$Lambda$SynchronizedCaptureSessionImpl$FYBJDMhVAN6TATAq887frkFPytI.run(Unknown Source:2)

        at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.workOnQueue(SequentialExecutor.java:229)

        at androidx.camera.core.impl.utils.executor.SequentialExecutor$QueueWorker.run(SequentialExecutor.java:171)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

        at java.lang.Thread.run(Thread.java:764)

 

 

Thank you in advance.

 

 

Sent from Mail for Windows 10

 

Android CameraX Discussion Group

unread,
Feb 16, 2021, 5:33:17 PM2/16/21
to Android CameraX Discussion Group, gioura...@gmail.com
Hi Giouri,

Thank you for writing to the development group - Unfortunately CameraX does not plan on support external UVC cameras at the moment. 

Thanks

Scott Nien

unread,
Feb 17, 2021, 10:48:50 PM2/17/21
to Android CameraX Discussion Group, gioura...@gmail.com
Hi Giouri,  
As we said, CameraX doesn't officially support usb cameras so it might or might not work as we didn't test it intensively. 

From the logs, I doubt that it is caused by not sufficient memory in raspberry.   Maybe you can try to lower the resolution of ImageAnalysis by setting setTargetResolution in the ImageAnalysis.Builder,  something like 240X320 in portrait mode, or 320x240 in landscape mode, size in setTargetResolution is sensitive to the orientation.
If that fixes the problem,  then probably it is the memory issue. 

Scott

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/80b5194e-dc24-4375-bf01-e8412c788f7bn%40android.com.

Giouri Kilinkaridis

unread,
Feb 19, 2021, 8:40:37 AM2/19/21
to Scott Nien, Android CameraX Discussion Group

Hello,

Thank you very much for your advice, by the way I accidently send you twice the same email sorry for that.

Have a nice day

 

Sent from Mail for Windows 10

 

Scott Nien

unread,
Feb 19, 2021, 9:49:49 PM2/19/21
to Giouri Kilinkaridis, Android CameraX Discussion Group
Hi Giouri, 
Not a problem and it is really great to have the feedback on CameraX apps running on Raspberry Pi and USB camera. That's something we lack testing. 


Reply all
Reply to author
Forward
0 new messages