Code to capture image through webcam..

hi.. im doing final year engineering.. rite now in project works n so i need a complete code in java to capture image through webcam..can anybody pls help me in this...thanks in advance..
[208 byte] By [SanthoshSantoa] at [2007-11-26 20:30:25]
# 1
Try this: http://forum.java.sun.com/thread.jspa?threadID=570463&start=0&tstart=0
lfschucka at 2007-7-10 1:20:12 > top of Java-index,Java Essentials,Java Programming...
# 2
thanks alot.. lfschuck for ur kind reply... this ll b more useful for me....
SanthoshSantoa at 2007-7-10 1:20:12 > top of Java-index,Java Essentials,Java Programming...
# 3

can anybody suggest me on this coding n get me a full pharse of this program ready for execution....

think tis will b a easiest way to capture an image through webcam...!

INCOMPLETE PROGRAM :

```````````````````````````````````

CaptureDeviceInfo deviceInfo = CaptureDeviceManager.getDevice("vfw:Microsoft WDM Image Capture (Win32):0");

Player player = Manager.createRealizedPlayer(deviceInfo.getLocator());

player.start();

// Wait a few seconds for camera to initialise (otherwise img==null)

Thread.sleep(2000);

//take image from camera

FrameGrabbingControl frameGrabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl");

Buffer buf = frameGrabber.grabFrame();

Image img1 = (new BufferToImage((VideoFormat)buf.getFormat()).createImage(buf));

.....

then you can save image as image.jpg into buffer your computer

code:

....

BufferedImage buffImg = new BufferedImage(img1.getWidth(null), img1.getHeight(null), BufferedImage.TYPE_INT_RGB);

Graphics2D g2D = buffImg.createGraphics();

g2D.drawImage(img1, null, null);

g2D.setColor(Color.RED);

g2D.setFont(new Font("Verdana",Font.BOLD,16));

g2D.drawString((new Date()).toString(),10,25);

g2D.dispose();

ImageIO.write(buffImg,"jpg",new File("../Test/Webcam/Webcam" + " " + Params.Num + ".jpg"));

SanthoshSantoa at 2007-7-10 1:20:12 > top of Java-index,Java Essentials,Java Programming...