Package anlavn.opencv
Class FaceDetection
java.lang.Object
anlavn.opencv.FaceDetection
The FaceDetection class supports to face detection using the world’s largest computer vision library - OpenCV.
This class provides methods to load required libraries, configure settings, start/end face detection, and display on JPanel.
This class provides methods to load required libraries, configure settings, start/end face detection, and display on JPanel.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidend()Use this method to end face detection.static final BufferedImageUse this method to get the BufferedImage of the entire frame being displayed on the JPanel.static final booleanUse this method to get value of face detection is running or not.static final booleanUse this method to get the value of whether or not a face is being detected.static final voidUse this method to load Module support for face detection.static final voidsetDetector(boolean detectFace) Use this method to set the face detection frame.static final voidsetDetector(boolean detectFace, Color color, int thickness) Use this method to set the face detection frame.static final voidsetDisplayPanel(JPanel pan) Use this method to set the panel where will display the camera capture.static final voidsetDisplayPanel(JPanel pan, int borderRadius) Use this method to set the panel with corner where will display the camera capture.static final voidstart(int index) Use this method to start face detection using ID camera.
-
Field Details
-
API_KEY
-
-
Constructor Details
-
FaceDetection
public FaceDetection()
-
-
Method Details
-
loadModule
public static final void loadModule()Use this method to load Module support for face detection. -
setDisplayPanel
Use this method to set the panel where will display the camera capture.- Parameters:
pan- is JPanel you want to display the camera capture.- See Also:
-
setDisplayPanel
Use this method to set the panel with corner where will display the camera capture.- Parameters:
pan- is JPanel you want to display the camera capture.borderRadius- is corner border radius of JPanel.- See Also:
-
setDetector
public static final void setDetector(boolean detectFace) Use this method to set the face detection frame.- Parameters:
detectFace-truea rectangle will display when we detect a face.falsethe rectangle will not display even we detect a face.- See Also:
-
setDetector
Use this method to set the face detection frame.- Parameters:
detectFace-truea rectangle will display when we detect a face.falsethe rectangle will not display even we detect a face.color- is the color of rectangle when it display.thickness- is the thickness of rectangle when it display.- See Also:
-
start
public static final void start(int index) Use this method to start face detection using ID camera.- Parameters:
index- ID of the video capturing device to open. To open default camera using 0 value.- See Also:
-
end
public static final void end()Use this method to end face detection.- See Also:
-
isDetector
public static final boolean isDetector()Use this method to get the value of whether or not a face is being detected.- Returns:
trueif you was set to detect a face,falseif you wasn't set value or set to not detect a face.- See Also:
-
isDetection
public static final boolean isDetection()Use this method to get value of face detection is running or not.- Returns:
trueif startDetection() method is running,falseif not.- See Also:
-
getBufferedImage
Use this method to get the BufferedImage of the entire frame being displayed on the JPanel.- Returns:
- a BufferedImage of entire frame in JPanel.
-