How to take single snapshots from a webcam?

后端 未结 4 1538
死守一世寂寞
死守一世寂寞 2020-12-21 14:51

I want to take a snapshot with my webcam using java and save it to a jpg file. What are the steps needed to do so? A tutorial would be greatly appreciated.

Greetings

4条回答
  •  Happy的楠姐
    2020-12-21 15:36

    Try webcam-capture project.

    This code will take a snapshot from webcam (embedded, connected to USB or IP camera) and save it into JPG file:

    Webcam webcam = Webcam.getDefault();
    webcam.open()
    BufferedImage image = webcam.getImage();
    ImageIO.write(image, "JPG", new File("test.jpg"));
    

提交回复
热议问题