Salve, qualcuno mi può mostrare del codice per catturare video da webcam??
Grazie ciao
marco
Salve, qualcuno mi può mostrare del codice per catturare video da webcam??
Grazie ciao
marco
http://webandother.forumfree.net
Il forum della programmazione in java e non solo...
ho provato anche con questo codice ma mi da una NullPointerException:
import java.awt.*;
import java.util.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.protocol.*;
import javax.swing.*;
public class Play extends JFrame {
private Player player;
private Processor processore=null;
private CaptureDeviceInfo device;
public Play()
{
super("Cattura video");
this.setSize(new Dimension(700,500));
this.setLocationRelativeTo(null);
this.setEnabled(true);
this.setBackground(Color.BLUE);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
VideoFormat formatoVideo=new VideoFormat(VideoFormat.RGB);
Vector deviceList=CaptureDeviceManager.getDeviceList(form atoVideo);
if(deviceList.size()>0)
device=(CaptureDeviceInfo) deviceList.elementAt(0);
try {
MediaLocator locator=device.getLocator();
DataSource data=null;
player=Manager.createPlayer(locator);
player.realize();
while(player.getState()!=Player.Realized)
Thread.sleep(500);
player.start();
Container c=this.getContentPane();
c.setLayout(new BorderLayout());
c.add(player.getVisualComponent(), BorderLayout.CENTER);
c.add(player.getControlPanelComponent(), BorderLayout.SOUTH);
}
catch(Exception eccezione)
{
JOptionPane.showMessageDialog(null, "Non funziona "+eccezione.toString());
}
this.setVisible(true);
}
public static void main(String args[])
{
new Play();
}
}
Qualcuno mi può rispondere perfavore??
Grazie
Marco
http://webandother.forumfree.net
Il forum della programmazione in java e non solo...
possibile che non mi risponde nessuno??
http://webandother.forumfree.net
Il forum della programmazione in java e non solo...