@Reference(type=Inproceedings, author={"Viola, P.","Jones, M."}, title="Rapid object detection using a boosted cascade of simple features", year="2001", booktitle="Computer Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the 2001 IEEE Computer Society Conference on", pages={" I","511 "," I","518 vol.1"}, number="", volume="1", customData={"keywords"," AdaBoost; background regions; boosted simple feature cascade; classifiers; face detection; image processing; image representation; integral image; machine learning; object specific focus-of-attention mechanism; rapid object detection; real-time applications; statistical guarantees; visual object detection; feature extraction; image classification; image representation; learning (artificial intelligence); object detection;","doi","10.1109/CVPR.2001.990517","ISSN","1063-6919 "}) public class HaarCascadeDetector extends Object implements FaceDetector<DetectedFace,FImage>
HaarCascadeDetector.BuiltInCascade
are the same as those available in OpenCV.Modifier and Type | Class and Description |
---|---|
static class |
HaarCascadeDetector.BuiltInCascade
The set of pre-trained cascades from OpenCV.
|
Modifier and Type | Field and Description |
---|---|
protected Detector |
detector |
protected DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> |
groupingFilter |
protected boolean |
histogramEqualize |
Constructor and Description |
---|
HaarCascadeDetector()
Construct with the
HaarCascadeDetector.BuiltInCascade.frontalface_default cascade. |
HaarCascadeDetector(int minSize)
Construct with the
HaarCascadeDetector.BuiltInCascade.frontalface_default cascade and
the given minimum search window size. |
HaarCascadeDetector(String cas)
Construct with the given cascade resource.
|
HaarCascadeDetector(String cas,
int minSize)
Construct with the given cascade resource and the given minimum search
window size.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
binaryHeader()
Header for binary input.
|
List<DetectedFace> |
detectFaces(FImage image)
Detect faces in the image and return a list of faces found.
|
StageTreeClassifier |
getCascade() |
Detector |
getDetector() |
DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> |
getGroupingFilter() |
int |
getMaxSize() |
int |
getMinSize() |
double |
getScaleFactor() |
int |
hashCode() |
static HaarCascadeDetector |
read(InputStream is)
Deserialize the detector from a stream.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
save(OutputStream os)
Serialize the detector using java serialization to the given stream
|
void |
setCascade(String cascadeResource)
Set the cascade classifier for this detector.
|
void |
setGroupingFilter(DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> grouping)
Set the filter for merging detections
|
void |
setMaxSize(int size)
Set the maximum detection window size
|
void |
setMinSize(int size)
Set the minimum detection window size
|
void |
setScale(float scaleFactor)
Set the detector scale factor
|
String |
toString() |
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
protected DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> groupingFilter
protected boolean histogramEqualize
public HaarCascadeDetector(String cas)
setCascade(String)
to understand how the cascade is loaded.cas
- The cascade resource.setCascade(String)
public HaarCascadeDetector()
HaarCascadeDetector.BuiltInCascade.frontalface_default
cascade.public HaarCascadeDetector(int minSize)
HaarCascadeDetector.BuiltInCascade.frontalface_default
cascade and
the given minimum search window size.minSize
- minimum search window sizepublic HaarCascadeDetector(String cas, int minSize)
setCascade(String)
to understand how the
cascade is loaded.cas
- The cascade resource.minSize
- minimum search window size.setCascade(String)
public int getMinSize()
public void setMinSize(int size)
size
- the window sizepublic int getMaxSize()
public void setMaxSize(int size)
size
- the window sizepublic DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> getGroupingFilter()
public void setGroupingFilter(DetectionFilter<Rectangle,ObjectIntPair<Rectangle>> grouping)
grouping
- public List<DetectedFace> detectFaces(FImage image)
FaceDetector
detectFaces
in interface FaceDetector<DetectedFace,FImage>
image
- Image to search inpublic double getScaleFactor()
Detector.getScaleFactor()
public void setCascade(String cascadeResource) throws Exception
cascadeResource
- The cascade to load.Exception
- if there is a problem loading the cascade.public void setScale(float scaleFactor)
scaleFactor
- the scale factorDetector.setScaleFactor(float)
public void save(OutputStream os) throws IOException
os
- the streamIOException
public static HaarCascadeDetector read(InputStream is) throws IOException, ClassNotFoundException
save(OutputStream)
.is
- HaarCascadeDetector
read from stream.IOException
ClassNotFoundException
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic StageTreeClassifier getCascade()
public Detector getDetector()
Detector
.