android - 从后台服务中使用相机
我试图弄清楚是否可以在后台服务中使用摄像头视频流,而不是从正常意图中使用。
我的想法是:
- 从我的应用程序启动服务,
- 该服务访问视频流并持续提取特征;根据功能,它会将网络数据包(到本地主机)
- 用户切换到另一个应用程序 - 服务必须仍在运行并提取功能!
在尝试实现所有这些之前,我想知道是否这是可能的。
预先感谢
尼古拉
I'm trying to figure out if it is possible to use a camera video stream from within a background service rather than from a normal intent.
What I had in mind is this:
- start the service from my app
- this service accesses the video stream and extracts features continuously; depending on the features, it sends network packets (to localhost)
- user switches to another app - the service must still be running and extracting features!
Before trying to implement all that, I'd like to know if it was possible.
Thanks in advance
Nicola
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,有可能,请在一个类似的线程上检查我的答案和示例代码
从 android 中的后台服务打开/运行相机
yes its possible, check my answer and sample code on one similar thread
Open/Run Camera from background service in android
您必须在当前屏幕上显示假预览。为此,您必须创建 1*1 像素尺寸的表面视图并在其中显示预览。为此,您必须在其他应用程序上绘制表面视图。
查看这个库,它提供了从背景捕获图像的功能,甚至可以从服务。
You have to show the fake preview over the current screen. For that you have to create the surface view with 1*1 px dimension and display the preview in that. You have to draw the surface view over other apps for that.
Check out this library that provides facility to capture image from the background even from the service.
我认为这是不可能的,因为相机需要预览屏幕。请参阅此处的上一个问题
I don't think this is possible as the camera needs a preview screen. See previous question here