import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
/**
* @author aldajo
*/
public class SingleCameraCapture {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
VideoCapture camera = new VideoCapture(1);
Mat framevideo = new Mat();
camera.open(1);
camera.read(framevideo);
Highgui.imwrite("image.png", framevideo);
}
}
The value in VideoCapture construct and camera.open method correspond to the number of the camera device in your computer. If you have only a web-cam, the value is 0.
I used the above code , and I have the following capture (my camera is a logitech c920):
No hay comentarios:
Publicar un comentario