I want to implement a java application, There is a login form and when user login failed then capture the user's image using default webcam and store it in a folder.
How can develop it?
I found some reference related to this topic.
I want to implement a java application, There is a login form and when user login failed then capture the user's image using default webcam and store it in a folder.
How can develop it?
I found some reference related to this topic.
Link to the project is https://github.com/sarxos/webcam-capture
More Refence - Capturing image from webcam in java?
YouTube Tutorial: https://www.youtube.com/watch?v=2BHyL_XK8YQ
Example code (take picture and save in test.jpg):
import com.github.sarxos.webcam.Webcam;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;
//Use try-catch block in the main method OR in any method & call that method in the main method
try {
// TODO add your handling code here:
//infoBox("Hello", "Beta");
Webcam webcam = Webcam.getDefault();
webcam.open();
BufferedImage image = webcam.getImage();
ImageIO.write(image, "JPG", new File("test.jpg"));
} catch (IOException ex) {
Logger.getLogger(LoginPage.class.getName()).log(Level.SEVERE, null, ex);
}