Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个使用后置摄像头的计算机视觉应用程序。
我正在使用 Android SDK for 4.0 (API 14)
我花了几天时间尝试通过 onPreviewFrame 实时获取预览帧,但到目前为止都失败了。
我认为当 previewDisplay 实际呈现在活动中时,相机实际上会调用预览回调。
但我必须仅在服务中捕获相机图像,而无需活动。
对此有什么建议吗?
我已经尝试过制作虚拟的surfaceView,但它不起作用。
我建议尝试Service.startActivity(intent)
Service.startActivity(intent)
服务没有 UI,你需要一个 Activity。但是你可以从你的服务启动一个活动。
另外,我认为您不能在用户不知情的情况下拍照。