在 Windows 中,我有一个带有 jymyron 库的 java swing 应用程序,用于使用网络摄像头的 cature 框架。但是 jmyron 库在 Fedora 中不支持。(在 Fedora 中不支持 dll 文件)。那么我可以在我的应用程序中使用什么库。如何安装that.plz 给出建议。实际上我尝试使用 jmf。但我无法正确安装它。因为我在代码中使用的图像采集卡在 linux 平台上不支持。代码就像。
package imagepanel;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class TestWebCam extends JFrame {
private FrameGrabber vision;
private BufferedImage image;
private VideoPanel videoPanel = new VideoPanel();
private JButton jbtCapture = new JButton("Show Video");
private Timer timer = new Timer();
public TestWebCam() {
JPanel jpButton = new JPanel();
jpButton.setLayout(new FlowLayout());
jpButton.add(jbtCapture);
setLayout(new BorderLayout());
add(videoPanel, BorderLayout.CENTER);
add(jpButton, BorderLayout.SOUTH);
setVisible(true);
jbtCapture.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
timer.schedule(new ImageTimerTask(), 1000, 33);
}
}
);
}
class ImageTimerTask extends TimerTask {
public void run() {
videoPanel.showImage();
}
}
class VideoPanel extends JPanel {
public VideoPanel() {
try {
vision = new FrameGrabber();
vision.start();
} catch (FrameGrabberException fge) {
}
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (image != null)
g.drawImage(image, 10, 10, 160, 120, null);
}
public void showImage() {
image = vision.getBufferedImage();
repaint();
}
}
public static void main(String[] args) {
TestWebCam frame = new TestWebCam();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(190, 210);
frame.setVisible(true);
}
}