JMF webcam capture tutorial
hi,
does anyone know of any good book or web tutorila I can use to help me understand my problem better. I have found the sun turorial difiicult to understand.
I have no tutorial, but I have a little code snippet you may find useful here
Similar Messages
-
Hey all,
I have done a lot of searching on this matter, but most of the threads are old. I am wondering if there has been any updates or if this issue has been solved in any way.
I am trying to create an applet that captures an image from a webcam. I created the applet, using sample code found somewhere on these forums, and it works perfectly. I modified it to take 6 screenshots instead of 1 when the Capture button is pressed, and that works perfectly. However, when I developed this I was at work (Windows XP). When I got home and attempted to test my work further I got the following error:
java.lang.RuntimeException: No permission to capture from applets
java.lang.RuntimeException: No permission to capture from applets
javax.media.NoPlayerException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.lang.RuntimeException: No permission to capture from applets
at javax.media.Manager.createPlayerForContent(Manager.java:1362)
at javax.media.Manager.createPlayer(Manager.java:417)
at javax.media.Manager.createRealizedPlayer(Manager.java:553)
at lib.snapshot.applet.Snapshot.init(Snapshot.java:68)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)I read, through these forums and searching google, that IE is in a sandbox in Vista, which makes signed applets only able to access java related data and certain temporary directories, rather than the whole system like other OS's. However, we have other signed applets that create directories in Program Files folders, download files from the server, etc that work fine in Vista, so that makes no sense. Also, I have disabled Protected Mode on my my machine and turned all security measures off, to no affect. Also the same thing happens in Firefox.
Has anyone found a way around this for Vista? Does anyone know of another easy to use java API for doing this that works in both Vista and XP? Has anyone who has encountered this problem ended up developing something similar in another language (flash, etc)?
I require this applet for taking snapshots for a project for my job. I had preferred Java, because our other applets are all Java and I didn't want to mix techonologies too much. But if there is no way to do this in a stable way for both Vista and XP, then I will have to look at other languages.
Thanks for the help.
Bryancompbry, the fundamental problem is that Vista is 3 years old and the latest releast of JMF is like, 5 or 6 years old. So, there's nothing in the realm of "Vista compatibility" for JMF.
That said, to my knowledge no one has ever gotten JMF to capture video from inside an applet in Vista, JMF installed on the computer or not.
However, if you have JMF installed, you can easily run a JMF web-start app that will work just fine in Vista, that would allow you to do whatever it is you're needing to do.
But if you're going in a different direction, I'd suggest looking at the Adobe Flex API. It's free and from what I've researched about it, it makes webcam and microphone capture damn easy. If you've got a decent web server that will allow you to do ColdFusion or (can't remember the term for it, but you can write Java code that will run on-demand on the web host that your Flex application can talk to to do stuff like upload the images, etc...), it should be a relatively easy and short as far as LOC is concerned, minus of course the learning curve associated with learning something new (which is why I've only researched it, but I would've played with it too had I had a "decent webserver" ;-) -
Webcam capture works fine in JMFStudio, not in Eclipse
Hi all,
I search the forum, but can't find any answer !
I'm trying to capture a webcam using JMF Performance Pack on XP64.
I can read the webcam in JMFStudio, but when using some code to do it, for instance in eclipse, it says :
java.io.IOException: Could not connect to capture deviceI tried with several code, some snippets found on this forum, some found on other, but the problem is always the same.
My webcam is well detected in the DeviceManager list.
What should be done to capture a video in my own class, knowing that this capture works well in JMF Studio ?
Thanks in advance,
PsyKoFor some reason your codes might me trying to connect to the wrong device.
Go to JMF - > JMF Registry -> Capture Devices and check the "name" of your webcam. For example, it could be something like "vfw:Creative WebCam NX (VFW):0"
Then, go to the code you are using and add the device "manually".
I dont know if that�s the problem, but you can try it. -
Manipulating Webcam capture??????
Hi
I have successfully managed to capture, transmit, receive and display (using an applet) a webcam capture using jmf.
However I want to let the user to put their mouse on the applet and be able to scroll around, zoom in and out etc..
Any suggestions?dear Fergus
My main objective is to capture / preview video using an applet and then capture a still image. save this still image to a file in users machine and then upload the file to the server at a specified folder.
this applet is a part of Student Registration system and to generate ID cards for students.
can you help me in this regards ? I have catagorized the requirements and other details. I am pasting the same here.
Video Capture Module
Objective: To capture a still image from a web page and Upload the image to specified folder on the server.
Technologies to be used: JAVA Applets, HTML & Servelets.
Synopsis: This application basically involves use of Java Media Framework. The primary objectives of this module are categorized according to the functionality.
1) Detect the video capture device on the users machine.
2) Preview the Live Video from the Detected Compatible Video Capture device.
3) Ask for user to click to take a snap and save the file in users machine at some temporary location with some unique file name.
4) Upload the file to the server at the specified path.
There are a few constraints to this application. These are identified in following according to severity of the constraint
1) Minimal download time for the applet and supporting files.
2) Browser compatibility with Internet Explorer 4.0 upward as well as Netscape Navigator 4.0 upward.
3) User interface flexibility and easy to plug-in to the main module.
4) Reusability of this module for other purposes.
There are few technological hurdles involved in doing this. These are stated below in order of severity.
1) Detecting the Capture Device on users machine.
2) User should not be asked to install Java Media Studio on his / her machine. Whatever the files are required should be loaded at the runtime.
3) Making the applet compatible with both the browser technologies.
Following assumptions are being made
1) The browsers are capable to handle applets i.e. the JVM & Java Plug-in are already installed.
2) Video capture device Drivers are installed in the machine and the Camera is plugged in to the system.
The assumptions are prerequisite and must be met.
Details of the Sub Modules:
SM-1: Detect Video capture Device in users machine.
This involves following steps
1) Initialize the applet and get permissions to access the system resources such as capture devices and other input devices. Having the signed applet with the required premissions can do this.
2) Once we have the permission to access the devices we can scan various input devices and store the information in some temporary place such as cookie.
3) If Compatible Video Capture device is found then query the Video capture device.
4) If the Video capture device is not found then prompt user to install the Video capture device and revert back to starting the applet again.
5) Check for the Device Capabilities. Compare that with our requirements.
6) If things are ok then we can proceed to next step else go back to step 4.
7) Save the device info for the future use possibly in a cookie.
SM-2: Preview the Live Video from the Detected Compatible Video Capture device.
This involves following steps
1) Read the information from the cookie.
2) Initialize the viewer for the Live Video.
3) Present the live video.
4) As a tool tip, we should suggest the user to focus the camera and adjust the camera lens to get a sharp image.
SM-3: Ask for user to click to take a snap and save the file in users machine at some temporary location with some unique file name.
This involves following steps
1) Ask user to look in to camera straight. Not to blink eyes while picture is being taken.
2) User should then click the snap button. As a useful tip we may also provide a keyboard short cut to capture the still image.
3) Once the image is captured show the still image instead of the live video.
4) Give an option to user to recapture the still image.
5) If user feels his / her image has been satisfactorily captured.
6) Ask for confirmation to save and upload the image to server.
SM-4: Upload the file to the server at the specified path.
This involves following steps
1) Check for user authentication.
2) Check for file name.
3) Check for file size.
4) If all above is ok then upload the image to server at the specified path.
regards
Virendra -
Jmf video capture in an Applet
Hello
I use netBeans 6.9.1 and would like to use JMF and the webcam capture JMF function in my applet
but Iget a no permission error see below
How can I get out of that?
Thank you
Fred
Public class SourceCam extends java.applet.Applet implements Runnable {
public int wmax,hmax,ix, x1, y1, x2, y2,y3,y4=0;
public double yc1=0.0,yc2=0.0, yc3=0.0,yc4=0.0,yc5=0.0,yc6=0.0;
Color colors[] = new Color[50];
int[] couleur=new int[50];
Thread runner;
Frame f=new Frame("Stimulated Polarized Light @FF ");
public static Player player = null;
public static MediaPlayer MediaPlayer1=null;
public CaptureDeviceInfo di = null;
public MediaLocator ml = null;
run:
java.lang.RuntimeException: No permission to capture from applets
java.lang.RuntimeException: No permission to capture from applets
javax.media.NoPlayerException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.lang.RuntimeException: No permission to capture from applets
at javax.media.Manager.createPlayerForContent(Manager.java:1362)
at javax.media.Manager.createPlayer(Manager.java:417)
at javax.media.Manager.createRealizedPlayer(Manager.java:553)
at org.me.light.SourceCam.init(SourceCam.java:58)
at sun.applet.AppletPanel.run(AppletPanel.java:424)
at java.lang.Thread.run(Thread.java:662)I did that already
i.e. what is written in
Q: Can I capture audio or video from within an Applet with JMF 2.1.1?
By default (for security reasons), JMF 2.1.1 does not allow capture from an applet. The user can turn this on by using JMFRegistry.
Run "java JMFRegistry", select the UserSettings tab and check "Allow Capture From Applets". If the browser's security permits loading native libraries, then you will now be able to capture audio/video from an applet.
but the program lines
try
player = Manager.createRealizedPlayer(ml);
FormatControl formatControl = (FormatControl)player.getControl("javax.media.control.FormatControl");
Component co = formatControl.getControlComponent();
Thread.sleep(2000);
player.start();
give always the same error
java.lang.RuntimeException: No permission to capture from applets
java.lang.RuntimeException: No permission to capture from applets
why?
I am working inside the netbeans 6.9.1 editor -
Dear all,
Using the Peter Parente's "webcam capture" library (Webcam Continuous Capture.vi), I faced some problems. In fact instead of showing for example one 320*240 picture it displayed some smaller pictures with some other parts of the picture indicator left blank(black).
What's the problem. Any help would be appreciated.
RegardsHello Smal,
I did a search for this library and it looks like it was developed some time ago. The FAQ on the download page seems to indicate that you need to make sure that your acquisition parameters in Windows and LabVIEW need to match in order for this to work properly. There was also a data type change between Vision 6.1 and 7.0 so that could be related, but it sounds more likely it is something else.
If your camera is DirectShow compatible and you have Vision, you can try IMAQ for USB. This, like Peter Parente's Library, is not actively being developed or supported by National Instruments Applications Engineers, but you may have some more luck, assuming you are using more recent versions of LabVIEW and Vision.
If there is a problem with a specific VI, please try to narrow down where the problem is occurring. You may be able to post an image that might indicate how the library is failing.
I hope this helps! Good luck with your application.
Regards,
Angela
Applications Engineer -
I am using Logitech Quickcam Pro 9000 on my computer and I am
trying to capture an image size of 533x280. I know it is a non
standard size. The camera does seem to capture the image at that
size, but it seems to truncate a lot of the image compared to
another size that I capture for a different application, the size
of which is 352x288, which is a standard CIF.
I have two question based on this observation
1. if I am streaming the bigger image (with details
truncated) to FMS, does it transmit more pixels than the truncated
image that appears on my screen. In short does it transmit more
than 533x280x30 fps.
2. Can webcams capture any size (within its outer bounds of
course) or do they capture only standard sizes that are closest to
the requested size. Does it make a difference in performance of the
webcam?
ThanksI would suggest you look at USTREAM. http://www.ustream.tv/
You can use this free web service to record and broadcast webcam streams from your own computer (or someone else's).
You can save the streams as an FLV file and then download the FLV to your own computer for editing. If your bandwidth is reasonable (e.g. 300 kbps) and you use a good quality web cam such as the Logitech C910, which is full HD, you should be able to get excellent video.
I'm currently using all of this to stream my daughter's wedding tomorrow. -
Here is the source code to JMF Webcam app + saves jpeg
Since so many people ask for this code, but never get it, I figured I'd repost it. I didn't write it, but I added the jpeg saving part, and modified it for my device, which you will have to do to get it to work. Just go into JMFRegistry and get the device name from your webcam and then edit the code. Also, keep in mind that some webcams don't work with JMF. You have to have a webcam that supports VFW or WDM interface.
And here's the code:
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.util.*;
import javax.media.control.*;
import javax.media.protocol.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import com.sun.image.codec.jpeg.*;
public class SwingCapture extends Panel implements ActionListener
public static Player player = null;
public CaptureDeviceInfo di = null;
public MediaLocator ml = null;
public JButton capture = null;
public Buffer buf = null;
public Image img = null;
public VideoFormat vf = null;
public BufferToImage btoi = null;
public ImagePanel imgpanel = null;
public SwingCapture()
setLayout(new BorderLayout());
setSize(320,550);
imgpanel = new ImagePanel();
capture = new JButton("Capture");
capture.addActionListener(this);
String str1 = "vfw:Logitech USB Video Camera:0";
String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
di = CaptureDeviceManager.getDevice(str2);
ml = di.getLocator();
try
player = Manager.createRealizedPlayer(ml);
player.start();
Component comp;
if ((comp = player.getVisualComponent()) != null)
add(comp,BorderLayout.NORTH);
add(capture,BorderLayout.CENTER);
add(imgpanel,BorderLayout.SOUTH);
catch (Exception e)
e.printStackTrace();
public static void main(String[] args)
Frame f = new Frame("SwingCapture");
SwingCapture cf = new SwingCapture();
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
playerclose();
System.exit(0);}});
f.add("Center",cf);
f.pack();
f.setSize(new Dimension(320,550));
f.setVisible(true);
public static void playerclose()
player.close();
player.deallocate();
public void actionPerformed(ActionEvent e)
JComponent c = (JComponent) e.getSource();
if (c == capture)
// Grab a frame
FrameGrabbingControl fgc = (FrameGrabbingControl)
player.getControl("javax.media.control.FrameGrabbingControl");
buf = fgc.grabFrame();
// Convert it to an image
btoi = new BufferToImage((VideoFormat)buf.getFormat());
img = btoi.createImage(buf);
// show the image
imgpanel.setImage(img);
// save image
saveJPG(img,"c:\\test.jpg");
class ImagePanel extends Panel
public Image myimg = null;
public ImagePanel()
setLayout(null);
setSize(320,240);
public void setImage(Image img)
this.myimg = img;
repaint();
public void paint(Graphics g)
if (myimg != null)
g.drawImage(myimg, 0, 0, this);
public static void saveJPG(Image img, String s)
BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.drawImage(img, null, null);
FileOutputStream out = null;
try
out = new FileOutputStream(s);
catch (java.io.FileNotFoundException io)
System.out.println("File Not Found");
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(bi);
param.setQuality(0.5f,false);
encoder.setJPEGEncodeParam(param);
try
encoder.encode(bi);
out.close();
catch (java.io.IOException io)
System.out.println("IOException");Hi William,
I've tried this code but I always get an null fgc with the following line.
FrameGrabbingControl fgc = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingCotrol");
So the player returns always null. The other thigns seem to be fine. I can view the image in the application but when I click capture it throws a Null Pointer Exception because fgc is null.
I am using Logitech QuickCam, USB, Win2k, jdk 1.3.1, JMF 2.1.1
Can you help me?
thanx,
Philip
Since so many people ask for this code, but never get
it, I figured I'd repost it. I didn't write it, but I
added the jpeg saving part, and modified it for my
device, which you will have to do to get it to work.
Just go into JMFRegistry and get the device name from
your webcam and then edit the code. Also, keep in mind
that some webcams don't work with JMF. You have to
have a webcam that supports VFW or WDM interface.
And here's the code:
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.util.*;
import javax.media.control.*;
import javax.media.protocol.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import com.sun.image.codec.jpeg.*;
public class SwingCapture extends Panel implements
ActionListener
public static Player player = null;
public CaptureDeviceInfo di = null;
public MediaLocator ml = null;
public JButton capture = null;
public Buffer buf = null;
public Image img = null;
public VideoFormat vf = null;
public BufferToImage btoi = null;
public ImagePanel imgpanel = null;
public SwingCapture()
setLayout(new BorderLayout());
setSize(320,550);
imgpanel = new ImagePanel();
capture = new JButton("Capture");
capture.addActionListener(this);
String str1 = "vfw:Logitech USB Video Camera:0";
String str2 = "vfw:Microsoft WDM Image Capture
ure (Win32):0";
di = CaptureDeviceManager.getDevice(str2);
ml = di.getLocator();
try
player = Manager.createRealizedPlayer(ml);
player.start();
Component comp;
if ((comp = player.getVisualComponent()) !=
)) != null)
add(comp,BorderLayout.NORTH);
add(capture,BorderLayout.CENTER);
add(imgpanel,BorderLayout.SOUTH);
catch (Exception e)
e.printStackTrace();
public static void main(String[] args)
Frame f = new Frame("SwingCapture");
SwingCapture cf = new SwingCapture();
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
playerclose();
System.exit(0);}});
f.add("Center",cf);
f.pack();
f.setSize(new Dimension(320,550));
f.setVisible(true);
public static void playerclose()
player.close();
player.deallocate();
public void actionPerformed(ActionEvent e)
JComponent c = (JComponent) e.getSource();
if (c == capture)
// Grab a frame
FrameGrabbingControl fgc =
fgc = (FrameGrabbingControl)
player.getControl("javax.media.control.FrameGrabbingCo
trol");
buf = fgc.grabFrame();
// Convert it to an image
btoi = new
= new BufferToImage((VideoFormat)buf.getFormat());
img = btoi.createImage(buf);
// show the image
imgpanel.setImage(img);
// save image
saveJPG(img,"c:\\test.jpg");
class ImagePanel extends Panel
public Image myimg = null;
public ImagePanel()
setLayout(null);
setSize(320,240);
public void setImage(Image img)
this.myimg = img;
repaint();
public void paint(Graphics g)
if (myimg != null)
g.drawImage(myimg, 0, 0, this);
public static void saveJPG(Image img, String s)
BufferedImage bi = new
new BufferedImage(img.getWidth(null),
img.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.drawImage(img, null, null);
FileOutputStream out = null;
try
out = new FileOutputStream(s);
catch (java.io.FileNotFoundException io)
System.out.println("File Not Found");
JPEGImageEncoder encoder =
r = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param =
m = encoder.getDefaultJPEGEncodeParam(bi);
param.setQuality(0.5f,false);
encoder.setJPEGEncodeParam(param);
try
encoder.encode(bi);
out.close();
catch (java.io.IOException io)
System.out.println("IOException"); -
JMF Video Capture within Applets
I would like to develop web conference..please helm me
venujakku wrote:
I would like to develop web conference..please helm meI just succesfully created a Java simple prototype application using JMF that can capture the webcam images in real time.
Just use the JMF and your set.
Edited by: deAppel on Oct 15, 2007 3:30 PM -
JMF Video Capture, output not properly
hello,
i'm trying to capture Video using JMStudio. my webcam is Logitech QuickCam IM, and it's detected succesfully by jmregistry. but then when i run jmstudio and start video capturing from logitech webcam, the output is only black and green, and beeping.
i don't know if anyone has ever experienced this before. what should i do to make it work?
Thank you.Sorry, that last post was misposted. It was supposed to go on a thread where the OP did resolve his problem. Sorry about that!
If your web cam isn't V4L compliant and only supports V4L2, then it won't work with JMF. Also, if you're using the cross-platform pack instead of the Solaris performance pack, it won't work with JMF.
Finally, if you're running it as a user with insufficent permissions to access the hardware, it won't work (try running as root just to check this). -
Filter with JMF before capture with third-party utility
Hello,
I'm just beginning to work with JMF - played a bit with it, especially with creating effect filters. Now I think need a nudge in the right direction, because it seems I'm stuck on something...
Here is what I'm trying to do (I don't know if it's even possible): I have a simple video effect filter that works on realtime the data from a webcam. Is it possible to somehow register the output stream from this filter as another capture device (?) that can be used in turn by third-party software (movie capture, skype, etc.)? Say, if I have the following:
[WEBCAM] -> [MY EFFECT FILTER] -> [SKYPE]
Is this possible at all, or I'm looking in the docs for something that's just not there?
Regards,
- Alex
P.S. Replies of the type "RTFM" are OK, especially if they contain info where to read, :-)
Message was edited by:
avtanskiOK thanks.
I've found a utility that modifes several of the date fields.
Now, I just want to be sure that I don't screw this up...
Which of the several date fields of a file holds the actual shot date?
Which of the date fields is used by the organizer to "organize" the video files (avi and mov's) chronologically?
Thanks for your help -
I need you help with webcam capturing
HIi everyone. I'm new to Java and most recently JMF , I working on a project that involves capturing images on a webcamera.I will appreciate it if anyone has a working code and steps that I can study to guide me through, I'm running late and I need to get it done.
Hope to hear from you soon.
THanks a lot
Tonii believe that this is the only upgrade for you ...
http://ati.amd.com/products/radeonx1900/RadeonX1900G5/index.html
i could be wrong, it has been known to happen ... -
I'm interested in getting a usb/firewire camera to capture imagery to be analyzed in real time with some java-based algorithms. After crawling the forums, it seems like most quicktime compatible cameras can be bridged in with QTJava.
My question though: Is there a camera that has a java api for it's actuation? ie- Is there a camera that works with JMF, that also has some sort of driver libraries to control movement? I'd prefer to not rewrite that code just yet, and there were some suggestions in previous threads for people to "write your own driver..."... so who wrote one and what camera do you use :)hello again guys..
im back here to see if someone has some other advices.. :)
i solved this problem on ubuntu.. but my client said he needs my java application running on Mandriva..
i already did everything i did on ubuntu..but im still cant connect the webcam on my java application..
at jmstudio and jmfregistry the device is found..so..help me.. :) -
Javafx use jmf and capture audio device
Hello, I noticed a problem with the use JavaFX and Java Media Framework (JMF), in a project javafx call Java classes using JMF, but are not recognized PC audio devices, in fact when I executed 's the code CaptureDeviceManager.getDeviceList (null), displays the error: "could not commit protocolPRefixList", without recognizing any audio device. Instead I call if my application using JMF, outside of a JavaFX project, the devices are found and everything works properly, perhaps this problem depends on the security settings of JavaFX, or inability to use JavaFX is that jmf interfaces with audio and video devices?
thanks for the helpI'd use jmf and javafx but it was not for capture devices.
If you use jmf there are native libraries.
The thing i found was about the java.library.path wich is overriden when you start javafx that jmf can't load approriate libs.
Try to compare the System.getProperties for java and javafx then you should find where is the problem. -
I cannot figure this out.
All I want to do is write a simple program that will take a still capture from my webcam and save it as a JPG. I don't need any kind of GUI or drawing to the screen. I will be using it in a batch script to take a picture and upload to my website at a fixed interval.
I have been messing around with it for a long time and have had no success. Here is some code I wrote just now that won't work. I have imported things while trying different pieces of code, but I never took any of them out. That's why I import so many things.
As you can see, I throw the NoPlayerException and CannotRealizeException. I do not understand why I get these. Also, when I run the program the light on my webcam turns on so I know it's connecting at some level. The file saved test.jpg is not a capture but rather a black square. Is my error in getting the image from the webcam or in writing it onto the BufferedImage so I can the write it to the file?
Any help would be appreciated.
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.util.*;
import javax.media.control.*;
import javax.media.protocol.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import com.sun.image.codec.jpeg.*;
import javax.imageio.ImageIO;
public class wc
public static Player player = null;
public static CaptureDeviceInfo di = null;
public static MediaLocator ml = null;
public static Buffer buf = null;
public static Image img = null;
public static BufferToImage btoi = null;
public static void main(String[] args) throws IOException, NoPlayerException, CannotRealizeException
String str = "vfw:Microsoft WDM Image Capture (Win32):0";
di = CaptureDeviceManager.getDevice(str);
ml = di.getLocator();
player = Manager.createRealizedPlayer(ml);
player.start();
FrameGrabbingControl fgc = (FrameGrabbingControl)
player.getControl("javax.media.control.FrameGrabbingControl");
buf = fgc.grabFrame();
btoi = new BufferToImage((VideoFormat)buf.getFormat());
img = btoi.createImage(buf);
BufferedImage bi = new BufferedImage(160, 120, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.drawImage(img, null, null);
File f = new File("test.jpg");
ImageIO.write(bi, "jpg", f);
}I have a question posted about this code, slightly modified in this thread:
http://forum.java.sun.com/thread.jspa?threadID=5310154&tstart=0
Would you check it out, I made a new thread because its not strictly related to this post.
Maybe you are looking for
-
So I have a MacBook that I acquired with the common problem of not turning on. However it is a conundrum I have not found the specific answer to in the forums. When I got it the power button didn't work, but it would go to sleep and wake up. It would
-
not a fan of ios7. Seriously looking at Android options. not interested in whatever 'improvements' come with the update. it has only caused me annoyance and wasted my time
-
Hi experts, Just wondering if it is OK to have a COMMIT in a Business Event. Below are some error messages I see: Event Error Name: WFENG_EVENT_NOTFOUND Event Error Message: Commit happened while dispatching the event xx.abc.adc.... I kind of get the
-
Hi all, When creating billing (trcode VF01) I get an error as:" Foreign trade data incomplate." How can I correct the error? Thanks&Regards
-
I am trying to add the Guided Procedure folder and callable object in to transport request thru the GP Admin via portal. I connected to the back-end R/3 endpoint and given the package information for including the transport request. But system throws