退出OPENCV 248 JAVA后,网络摄像头应用程序不会关闭
我刚刚完成了一个应用程序,它有一个jpanel显示网络摄像头的图像,我使用了OPENCV 2.4.8和VideoCapture,当我在netbeans中关闭框架时,程序仍在运行,所以我必须从netbean的停止底部关闭它。我试着运行应用程序*。第一次在windows中使用jar时,它工作正常,但当我关闭并再次打开它时,camara出现了问题,好像它已经被使用过了!!!有什么想法吗
下面是一段代码-
public static void main(String[] args) {
Permisos objPer = new Permisos();
objPer.setLocationRelativeTo(null);
objPer.setBounds(0, 0, 468, 328);
objPer.setVisible(true);
objPer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
webFrame panel = new webFrame();
pan1.add(panel);
Mat webcam = new Mat();
video = new VideoCapture(0);
if (video.isOpened()) {
while (true) {
video.read(webcam);
panel.MatToBufferedImage(webcam);
panel.setSize(webcam.width() + 40, webcam.height() + 60);
panel.repaint();
}
} else {
System.out.println("no video open");
}
}
当我拔下CAMARA并将其重新插入PC时,它会再次工作
共 (0) 个答案