Android Eclipse 模拟器上的相机:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3284583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:29:03  来源:igfitidea点击:

Camera on Android Eclipse emulator:

androidandroid-emulatorandroid-camera

提问by user225626

I don't have an embedded camera in the lid of my notebook. I'd be hooking up through an external USB camera.

我的笔记本电脑盖中没有嵌入式摄像头。我将通过外部 USB 摄像头连接。

The emulator runtime can pick this up right? I'll get the image displayed inside the AVD skin's screen in real time?

模拟器运行时可以选择这个吗?我会在 AVD 皮肤的屏幕内实时显示图像吗?

采纳答案by L?kling

Afaik the emulator wont show a realtime camera regardless.

Afaik 模拟器无论如何都不会显示实时相机。

If you need a live camera-source to use in your own app for debugging, there is a sollution at http://www.tomgibara.com/android/camera-source

如果您需要在自己的应用程序中使用实时相机源进行调试,可以在 http://www.tomgibara.com/android/camera-source 上找到解决方案

Updated for newer android versions: http://www.inter-fuser.com/2009/09/live-camera-preview-in-android-emulator.html

更新了较新的 android 版本:http: //www.inter-fuser.com/2009/09/live-camera-preview-in-android-emulator.html

回答by Ivin

In the current release of the emulator (Ice Cream Sandwich, API14;Linux), web camera support is available. Google's documentation and most answers available on the web do not yet reflect this. The emulator itself does:

在模拟器的当前版本(Ice Cream Sandwich,API14;Linux)中,可以使用网络摄像头支持。Google 的文档和网络上提供的大多数答案尚未反映这一点。模拟器本身会:

emulator -help
...
-fake-camera <mode>      set fake camera emulation mode
-webcam name=<name>[,dir=&lt;direction&gt;] setup web camera emulation
...
emulator -help-all

and further:

并进一步:

help for option -fake_camera

选项 -fake_camera 的帮助

Use -fake-camera <mode>to control fake camera emulation. Valid values for <mode> are:

使用-fake-camera <mode>来控制假相机模拟。<mode> 的有效值为:

off   -> disable fake camera emulation
back  -> fake camera is facing back
front -> fake camera is facing front

help for option -webcam

选项 -webcam 的帮助

  • -webcam offto disable web camera emulation.
  • -webcam listto list web cameras available for emulation.
  • -webcam name=[,dir=<direction>]to setup parameters for web camera emulation.

    • <name> platform-independent name identifying emulated camera device.
    • <direction>defines direction the camera is facing. Valid values are:

      • front-> emulate camera as facing front
      • back-> emulate camera as facing back

        Default direction value for emulated web camera is 'front'

  • -webcam off禁用网络摄像头仿真。
  • -webcam list列出可用于仿真的网络摄像头。
  • -webcam name=[,dir=<direction> ]设置网络摄像头仿真参数。

    • <name> 与平台无关的名称,用于标识模拟的相机设备。
    • <direction>定义相机面向的方向。有效值为:

      • 正面-> 将相机模拟为面向正面
      • back-> 将相机模拟为面向后

        模拟网络摄像头的默认方向值为“正面”

回答by Joe Fernandez

Time to upgrade your ADK!

是时候升级您的 ADK 了!

As of Android SDK version 14, the emulator supports webcams to simulate a camera:

从 Android SDK 版本 14 开始,模拟器支持网络摄像头来模拟摄像头:

General notes - Added webcam support to Android 4.0 or later platforms to emulate rear-facing cameras when one webcam is present, and to emulate both rear-facing and front-facing cameras when two webcams are present. Webcam suport is for Windows and Linux only. Mac support will come in a later release.

一般说明 - 向 Android 4.0 或更高版本平台添加了网络摄像头支持,以在存在一个网络摄像头时模拟后置摄像头,并在存在两个网络摄像头时模拟后置和前置摄像头。网络摄像头支持仅适用于 Windows 和 Linux。Mac 支持将在以后的版本中提供。

from: Android SDK Tools, SDK Tools, Revision 14

来自:Android SDK 工具,SDK 工具,修订版 14

It works! I've tried this myself.

有用!我自己试过这个。

回答by Josiah

From the android documentation:

从安卓文档:

Emulator Limitations

In this release, the limitations of the emulator include:

模拟器限制

在此版本中,模拟器的限制包括:

...

...

No support for camera/video capture

不支持相机/视频捕捉

...

...

In other words, no, you cannot access or preview the camera in the emulator.

换句话说,不,您无法在模拟器中访问或预览相机。