package againtest; import org.opencv.core.*; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.videoio.VideoCapture; public class VideoCap { public static void main(String[] args) { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); VideoCapture camera = new VideoCapture(); camera.open(0); if(!camera.isOpened()){ System.out.println("Error"); } else { Mat frame = new Mat(); while(true){ if (camera.read(frame)){ System.out.println("Frame Obtained"); System.out.println("Captured Frame Width " + frame.width() + " Height " + frame.height()); Imgcodecs.imwrite("image/camera.jpg", frame); System.out.println("OK"); break; } } } camera.release(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)