Pessoal, to dando uma estudada sobre Realidade aumentada usando java, dai achei um codigo na internet mas to tendo um problema pra roda e gostaria da ajuda de vcs!
Aparece a seguinte msg quando mando roda:
Exception in thread “main” java.lang.UnsatisfiedLinkError: no JARVideo in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at net.sourceforge.jartoolkit.videoinput.videocapturing.JARVideo.(JARVideo.java:65)
at JARVideoTester.(JARVideoTester.java:135)
at JARVideoTester.main(JARVideoTester.java:115)
Segue ai o codigo pra vcs darem uma olhada:
/**
* JARVideoTesterTester: The graphical userinterface for testing JARVideoTester
*
* @version 0.1
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import net.sourceforge.jartoolkit.videoinput.videocapturing.JARVideo;
public class JARVideoTester extends JPanel
{
/** The Version of JARVideoTester */
final public static String version = "Version 0.1(alpha)";
private BufferedImage bi;
private int bitcount;
private JButton button;
private int dataArray[];
private DataBuffer db;
private int height;
/** JARVideoTester Class */
private JARVideo myJARVideo;
/** The mainpanel of the frame */
private JPanel mypanel;
private Raster rast;
private WritableRaster raster;
private int size;
private SampleModel sm;
private int width;
/**
* The main method for executing the program
*
* @param args Commandline arguments.
* The first argument must be a path
*/
public static void main(String[] args)
{
String vers = System.getProperty("java.version");
if(vers.compareTo("1.1.2") < 0)
{
System.out.println("!!!WARNING: Swing must be run with a " + "1.1.2 or higher version VM!!!");
}
// Force SwingSet to come up in the Cross Platform L&F
try
{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
// If you want the System L&F instead, comment out the above line and
// uncomment the following:
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception exc)
{
System.out.println("Error loading L&F: " + exc);
}
JFrame frame = new JFrame("Video-Test");
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
JARVideoTester jar = new JARVideoTester();
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(jar, BorderLayout.CENTER);
// frame.getContentPane().add(new JButton("TEST"), BorderLayout.NORTH);
jar.setDoubleBuffered(true);
frame.setSize(jar.getWidth(), jar.getHeight());
frame.setResizable(false);
frame.setVisible(true);
jar.Test();
}
/**
* Constructor
*/
public JARVideoTester()
{
try
{
myJARVideo = JARVideo.create("inputDevive=WDM_CAP,flipV,showDlg");
}
catch(InstantiationException e)
{
System.err.println(e);
System.exit(0);
}
// myJARVideo.setFlippedImage(true);
myJARVideo.grabFrame();
width = myJARVideo.getWidth();
height = myJARVideo.getHeight();
bitcount = myJARVideo.getBitCount();
size = (int)myJARVideo.getBufferSize();
System.out.println("Bildbreite: " + width);
System.out.println("BildHöhe: " + height);
System.out.println("Bits per Pixel: " + bitcount);
System.out.println("Size: " + size);
dataArray = new int[(size >> 2)];
myJARVideo.getBuffer(dataArray);
bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
g2.setBackground(new Color(255, 255, 255, 255));
// .. clear canvas ..
g2.clearRect(0, 0, width, height);
raster = bi.getRaster();
db = raster.getDataBuffer();
sm = bi.getSampleModel();
raster.setDataElements(0, 0, width, height, dataArray);
}
/** Method for exit the program */
private void ExitProgramReally()
{
System.exit(0);
}
public int getHeight()
{
return height;
}
public Dimension getPreferredSize()
{
return new Dimension(width, height);
}
public Dimension getSize(Dimension rv)
{
if(rv == null)
{
return new Dimension(width, height);
}
else
{
rv.setSize(width, height);
}
return rv;
}
public int getWidth()
{
return width;
}
public void paint(Graphics g)
{
// System.out.println("Paint");
}
public void Test()
{
Graphics2D graph = (Graphics2D)this.getGraphics();
while(true)
{
myJARVideo.getNextBuffer(dataArray);
raster.setDataElements(0, 0, width, height, dataArray);
graph.drawImage(bi, 0, 0, this);
}
}
}
Valeu galera!