How to Use Web Camera in Android Emulator to Capture a Live Image

How to use web camera in android emulator to capture a live image?


  1. Download all the source files listed on the page: CameraSource, GenuineCamera, HttpCamera, SocketCamera, BitmapCamera, and WebcamBroadcaster.
  2. Create a package in your project called com.tomgibara.android.camera and place the first 4 source files inside.
  3. Download JMF from here and install it.
  4. Compile WebcamBroadcaster using the following command: "C:\Program Files (x86)\Java\jdk1.6.0_15\bin\javac.exe" -classpath "C:\Program Files (x86)\JMF2.1.1e\lib" WebcamBroadcaster.java or what's equivalent to it.
  5. Run it with the following command and keep it running: java "-Djava.library.path=C:\Program Files (x86)\JMF2.1.1d\lib" WebcamBroadcaster
  6. Use the following code in your program:
CameraSource cs = new SocketCamera("192.168.0.100", 9889, 320, 240, true);
if (!cs.open()) {
/* deal with failure to obtain camera */
}
while(/*some condition*/) {
cs.capture(canvas) //capture the frame onto the canvas
}
cs.close();

PS: I haven't been able to test this because I'm getting an error when I run WebcamBroadcaster.

PPS: I just started experimenting with Android today so all this could be wrong.

Android: How to use webcam in emulator?

UPDATE

In Android Studio AVD:

  1. Open AVD Manager:

AVD menu


  1. Add/Edit AVD:

Specific AVD strip


  1. Click Advanced Settings in the bottom of the screen:

AVD Advanced Settings


  1. Set your camera of choice as the front/back cameras:

AVD Camera Settings

Using Camera in the Android emulator

Update: ICS emulator supports camera.

Android emulator camera custom image

Download the source from following url . This is work as the another Gallery in the emulator.
While passing intent to capture image from camera choose this gallery. this is looks like samsung mobile 3d gallery.. this will return the default images.. in emulators . one more thing it will work fine after 3.0 versions only.

https://github.com/c-jiang/Gallery3D-Mod

Android Emulator + Web Cam

Take a look at this question here at stackoverflow: How to use web camera in android emulator to capture a live image?

Webcam for testing camera in Android AVD?

Using Eclipse.

  • AVD Manager
  • Edit the AVD.
  • Hardware > New:
  • Configures camera facing backwards = "webcam0" (use dropdown).

Run project using that AVD.



Related Topics



Leave a reply



Submit