gpt4 book ai didi

java - 如何修复 "The application may be doing too much work on its main thread"(Android)

转载 作者:太空宇宙 更新时间:2023-11-03 22:13:50 26 4
gpt4 key购买 nike

<分区>

我正在开发一个 android 应用程序,我可以在其中进行高级图像处理,并且我使用自定义相机预览来捕获图像,但是当我在启动该应用程序后检查 logcat 时,我发现了来自 Choreographer Skipped 440 frames 的消息!应用程序可能在其主线程上做了太多工作

我的日志如下

05-07 10:04:11.480: I/CameraPreview(28340): Orientation Changed
05-07 10:04:11.990: I/Choreographer(28340): Skipped 145 frames! The application may be doing too much work on its main thread.
05-07 10:04:15.620: I/Choreographer(28340): Skipped 212 frames! The application may be doing too much work on its main thread.
05-07 10:04:20.590: I/CameraPreview(28340): +++++++++++++++++++++++++++++++++++++++
05-07 10:04:20.590: I/CameraPreview(28340): starting recognition process
05-07 10:04:22.490: I/FaceDetector(28340): Number of faces found: 1
05-07 10:04:22.490: I/Value X(28340): 273
05-07 10:04:22.500: I/Value Y(28340): 106
05-07 10:04:22.500: I/Bitmap Width :(28340): 640
05-07 10:04:22.510: I/Bitmap Height :(28340): 480
05-07 10:04:22.520: I/CameraPreview(28340): Bitmap Size : 205 : 201
05-07 10:04:22.520: I/Face Recognition(28340): ===========================================
05-07 10:04:22.520: I/Face Recognition(28340): recognizeFace (single face)
05-07 10:04:22.550: I/CameraPreview(28340): Previwe Stoped Face Detected....
05-07 10:04:22.550: I/CameraPreview(28340): Stopping preview in SurfaceDestroyed().
05-07 10:04:22.720: I/CameraPreview(28340): Total Recognition process took: 2.127638333
05-07 10:04:22.720: I/Choreographer(28340): Skipped 440 frames! The application may be doing too much work on its main thread.
  • 我经常在 onFramePreview() 方法中使用自定义相机预览捕获缓冲区图像,如果它包含“人脸”,则发送它进行处理。
  • 当图像处理部分被执行时,它的帧被跳过编舞和我没有得到预期的结果。
  • 我使用 OpenCV 进行图像处理

请帮我解决这个问题。我在 StackOverflow 中搜索了很多次,但没有得到正确的答案。

谢谢

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com