public class FaceRecognizer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
FaceRecognizer.Eyes
A filter that detects eyes and faces.
|
class |
FaceRecognizer.Faces
A filter that detects faces.
|
Constructor and Description |
---|
FaceRecognizer()
Construct an instance of FaceRecognizer and load the face
recognition classifier.
|
Modifier and Type | Method and Description |
---|---|
org.opencv.core.Mat |
bufferedImage2Mat(java.awt.image.BufferedImage source)
Convert a BufferedImage object to OpenCV's Mat representation.
|
org.opencv.core.Rect[] |
detectFaces(org.opencv.core.Mat img)
Detect faces.
|
java.awt.image.BufferedImage |
filter(java.awt.image.BufferedImage source,
java.lang.String filterName)
Apply the specified filter to the source image.
|
int |
getFaceCount()
Return the number of faces detected.
|
org.opencv.core.Rect[] |
getFaceRectangles()
Return the number of faces detected.
|
java.awt.image.BufferedImage |
mat2BufferedImage(org.opencv.core.Mat matrix)
Convert a Mat image into a BufferedImage.
|
void |
setMaxFaceSize(int size)
Set the maximum face size.
|
void |
setMinFaceSize(int size)
Set the minimum face size.
|
java.lang.String |
toString()
Return a string description of the filter.
|
public FaceRecognizer() throws java.io.IOException
java.io.IOException
- If the shared library cannot be found.public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage source, java.lang.String filterName) throws IllegalActionException
source
- The source image to transform.filterName
- "eyes" or "faces".IllegalActionException
- If the filter is anything other
than "eyes" or "faces".public org.opencv.core.Mat bufferedImage2Mat(java.awt.image.BufferedImage source)
source
- BufferedImage inputpublic java.awt.image.BufferedImage mat2BufferedImage(org.opencv.core.Mat matrix)
matrix
- Mat inputpublic org.opencv.core.Rect[] detectFaces(org.opencv.core.Mat img) throws java.io.IOException
img
- The image containing facesjava.io.IOException
- if the haar cascade file cannot be found.public int getFaceCount()
public org.opencv.core.Rect[] getFaceRectangles()
public void setMinFaceSize(int size) throws IllegalActionException
size
- the minimum face size, which must be positive.IllegalActionException
- If the value of the size parameter is less than 0.public void setMaxFaceSize(int size) throws IllegalActionException
size
- the maximum face size, which must be positive.IllegalActionException
- If the value of the size parameter is less than 0.public java.lang.String toString()
toString
in class java.lang.Object