Android的:如何使用网络摄像头在模拟器? [英] Android: How to use webcam in emulator?

查看:1765
本文介绍了Android的:如何使用网络摄像头在模拟器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过在AVD管理的前置摄像头设置为webcam0连接一个摄像头,以我的模拟器。当我开始仿真器的摄像头应用程序,我得到的错误

I'm connecting a webcam to my emulator by setting the front camera to "webcam0" in the AVD Manager. When I start the emulator's camera application, I get the error

CameraService::connect X (pid 702) rejected (invalid cameraId 0).

下面是Android操作系统code中的相关部分:

Here's the relevant portion of the Android source code:

sp<ICamera> CameraService::connect(
    const sp<ICameraClient>& cameraClient, int cameraId) {

    int callingPid = getCallingPid();

    [...]

    if (cameraId < 0 || cameraId >= mNumberOfCameras) {
        LOGE("CameraService::connect X (pid %d) rejected (invalid cameraId %d).",
            callingPid, cameraId);
        return NULL;
    }

    [...]
}

网络摄像头已正确分配为0的ID,因为只有1个摄像头。然而, mNumberOfCameras 是presumably还是0。这意味着相机正在注册仿真器,但它没有尽力去更新连接摄像机的数量。

The webcam has been correctly assigned an ID of 0 because there's only 1 camera. However, mNumberOfCameras is presumably still 0. This means that the camera is being registered by the emulator, but it hasn't bothered to update the number of connected cameras.

我怎么能连接一个摄像头,这样它会得到妥善的仿真器能够识别?

编辑:命令模拟器-webcam名单-avd&lt;您的AVD&GT的名称; \ Android的软件开发工具包\工具给出结果:

the command emulator -webcam-list -avd <name of your AVD> in \android-sdks\tools gives the result:

List of web cameras connected to the computer:
Camera `webcam0` is connected to device `AndroidEmulatorVC0` on channel 0 using pixel format `BGR4`

当我启动摄像头从Eclipse的AVD管理器或使用仿真器 - 相机 - 前webcam0 -avd&lt;您的AVD&GT的名称; ,我得到如下窗口:

When I launch the webcam from Eclipse's AVD manager or using emulator -camera-front webcam0 -avd <name of your AVD>, I get the following window:

编辑2:这似乎是在模拟器中的错误。建议的答案告诉你怎样做才能设置摄像头,但并没有解决我的问题。我最终用一台笔记本电脑配有内置摄像头解决了这个问题。也许另一个USB摄像头可能也是可以的。

Edit 2: This seems to be a bug in the emulator. The suggested answer tells you what to do to set up the camera, but doesn't solve the problem for me. I ultimately solved it by using a laptop with a built-in webcam. Perhaps another USB webcam might have worked as well.

推荐答案

请在Eclipse下面的步骤。

Follow the below steps in Eclipse.

  1. 转到 - > AVD管理
  2. 创建/编辑AVD。
  3. 硬件>新:
  4. 配置摄像头对着背
  5. 点击的属性值,然后选择=webcam0。
  6. 一旦完成所有的摄像头上面应连接。如果它没有,那么你需要检查你的摄像头驱动程序。

点击此处查看更多信息: <一href="http://stackoverflow.com/questions/1276450/how-to-use-web-camera-in-android-emulator-to-capture-a-live-image">How使用网络摄像头的Andr​​oid模拟器捕获实时图像?

Check here for more information : How to use web camera in android emulator to capture a live image?

这篇关于Android的:如何使用网络摄像头在模拟器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆