OpenCV_webcam2.java
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.videoio.VideoCapture;
public class OpenCV_webcam2 {
static {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
}
public static void main(String[] args) {
VideoCapture camera = new VideoCapture();
camera.open(0);
if(!camera.isOpened()) {
System.out.println("Error");
}else {
Mat frame = new Mat();
try {
System.out.println("Utilisez la version Ryo de l'éclairage de battement de webcam");
camera.read(frame);
Thread.sleep(500);
camera.read(frame);
Thread.sleep(500);
camera.read(frame);
Thread.sleep(500);
Imgcodecs.imwrite("D:\\projects\\Java\\OpenCV_Samples\\resource\\imgs\\frame_clear.jpg ",frame);
System.out.println("Achèvement des applaudissements");
}catch(Exception e) {
e.printStackTrace();
}
}
camera.release();
}
}
Recommended Posts