android / android/camera-samples
fps reduces when image analysis usecase is applied
- Vorherrschende Sprache
- Kotlin
- Sterne
- 5.5k
- Forks
- 2.4k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm testing on
TECNO POP 2F (b1f)
CPU Core-Count = 4
RAM = 1.00G
Internal Storage = 16GB
Screen Resolution = 960 X 480
I'm using the CameraXBasic Example
The camera preview gets laggy only when the ImageAnalysis use case is applied.
I observed that without the imageAnalysis usecase the frame per seconds is approximately 10 on this device even tho the device will support up to 30fps (Range(lower=30, upper=30)
*Below are the supported fps Range*
Lower => 20, Upper => 20
Lower => 24, Upper => 24
Lower => 5, Upper => 30
Lower => 30, Upper => 30
When ImageAnalsis usecase is applied the fps drops to approximately 3fps
I/BufferQueueProducer: [ImageReader-864x480f23m4-18676-0](this:0x98965000,id:0,api:4,p:18676,c:18676) queueBuffer: fps=2.50 dur=1199.65 max=416.04 min=384.55
And i think this makes the CameraPreview Lag.
Are there any optimization techniques that can be applied to avoid making the preview lag?
I've attempted setting the fps myself but i don't think that has any effect
e.g
```kotlin
val builder = ImageAnalysis.Builder()
// We request aspect ratio but no resolution
.setTargetAspectRatio(screenAspectRatio)
// Set initial target rotation, we will have to call this again if rotation changes
// during the lifecycle of this use case
.setTargetRotation(rotation)
// The analyzer can then be assigned to the instance
val camera2Interop = Camera2Interop.Extender(builder)
// camera2Interop.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF)
camera2Interop.setCaptureRequestOption(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, Range(30, 30))
```
Beitragsleitfaden
Rechercherichtung
Beginne mit dem CameraXBasic Example und seinem ImageAnalysis-Anwendungsfall, indem du die Vorschau auf dem aufgeführten TECNO POP 2F mit und ohne Analyse reproduzierst. Untersuche die Konfiguration von ImageAnalysis.Builder und vergleiche die gemeldeten Bildraten; als abgeschlossen gilt die Aufgabe, wenn eine bestätigte Ursache identifiziert und eine Änderung dokumentiert oder getestet wurde, die verhindert, dass die Vorschau auf etwa 3 fps abfällt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, kotlin
- Bereich
- mobile, performance
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100