I have two webcams. Is it possible to list down all webcam devices in jComboBox?
我有两个网络摄像头。是否可以列出jComboBox中的所有网络摄像头设备?
public class pasporcheckin extends javax.swing.JFra {
private Dimension ds = new Dimension(450, 360);
private Dimension cs = WebcamResolution.VGA.getSize();
Here I have set webcam on device one!
在这里,我在设备一上设置了网络摄像头!
private Webcam wcam = Webcam.getWebcams().get(1);
private WebcamPanel wcampanel = new WebcamPanel((Webcam) wcam, ds, false);
/**
* Creates new form pasporcheckin
*/
public pasporcheckin() {
initComponents();
wcam.setViewSize(cs);
wcampanel.setFillArea(true);
panelCam.setLayout(new FlowLayout());
panelCam.add(wcampanel);
}
1 个解决方案
#1
0
Couldn't you add second camera in same way?
你不能以同样的方式添加第二台相机吗?
private Webcam wcam = Webcam.getWebcams().get(1);
private WebcamPanel wcampanel = new WebcamPanel((Webcam) wcam, ds, false);
private Webcam wcam2 = Webcam.getWebcams().get(2);
private WebcamPanel wcampanel2 = new WebcamPanel((Webcam) wcam2, ds, false);
/**
* Creates new form pasporcheckin
*/
public pasporcheckin() {
initComponents();
wcam.setViewSize(cs);
wcam2.setViewSize(cs);
wcampanel.setFillArea(true);
wcampanel2.setFillArea(true);
panelCam.setLayout(new FlowLayout());
panelCam.add(wcampanel);
panelCam.add(wcampanel2);
}
#1
0
Couldn't you add second camera in same way?
你不能以同样的方式添加第二台相机吗?
private Webcam wcam = Webcam.getWebcams().get(1);
private WebcamPanel wcampanel = new WebcamPanel((Webcam) wcam, ds, false);
private Webcam wcam2 = Webcam.getWebcams().get(2);
private WebcamPanel wcampanel2 = new WebcamPanel((Webcam) wcam2, ds, false);
/**
* Creates new form pasporcheckin
*/
public pasporcheckin() {
initComponents();
wcam.setViewSize(cs);
wcam2.setViewSize(cs);
wcampanel.setFillArea(true);
wcampanel2.setFillArea(true);
panelCam.setLayout(new FlowLayout());
panelCam.add(wcampanel);
panelCam.add(wcampanel2);
}