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 void
end()
Use this method to end face detection.static final BufferedImage
Use this method to get the BufferedImage of the entire frame being displayed on the JPanel.static final boolean
Use this method to get value of face detection is running or not.static final boolean
Use this method to get the value of whether or not a face is being detected.static final void
Use this method to load Module support for face detection.static final void
setDetector
(boolean detectFace) Use this method to set the face detection frame.static final void
setDetector
(boolean detectFace, Color color, int thickness) Use this method to set the face detection frame.static final void
setDisplayPanel
(JPanel pan) Use this method to set the panel where will display the camera capture.static final void
setDisplayPanel
(JPanel pan, int borderRadius) Use this method to set the panel with corner where will display the camera capture.static final void
start
(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
-true
a rectangle will display when we detect a face.false
the rectangle will not display even we detect a face.- See Also:
-
setDetector
Use this method to set the face detection frame.- Parameters:
detectFace
-true
a rectangle will display when we detect a face.false
the 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:
true
if you was set to detect a face,false
if 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:
true
if startDetection() method is running,false
if 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.
-