public class CLMAligner extends Object implements FaceAligner<CLMDetectedFace>
An aligner that warps a CLMDetectedFace
to the neutral pose
(reference shape) of the CLMFaceDetector.Configuration
.
Implementors of subclasses of this should note that if the triangles of the configuration are changed that the reference triangles must be recomputed.
Modifier and Type | Field and Description |
---|---|
protected CLMFaceDetector.Configuration |
config |
protected FImage |
mask |
protected List<Triangle> |
referenceTriangles |
protected int |
size |
Constructor and Description |
---|
CLMAligner()
Construct a new
CLMAligner using the default
CLMFaceDetector.Configuration and default size of 100 pixels. |
CLMAligner(int size)
Construct a new
CLMAligner using the default
CLMFaceDetector.Configuration and given size for the aligned output image. |
CLMAligner(int size,
CLMFaceDetector.Configuration config)
Construct a new
CLMAligner using the provided
CLMFaceDetector.Configuration and default size of 100 pixels. |
Modifier and Type | Method and Description |
---|---|
FImage |
align(CLMDetectedFace face)
For the provided face detection, return an aligned version of the face.
|
byte[] |
binaryHeader()
Header for binary input.
|
FImage |
getMask()
Return a mask image for aligned faces.
|
protected void |
loadReference() |
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
protected CLMFaceDetector.Configuration config
protected int size
protected transient List<Triangle> referenceTriangles
public CLMAligner()
CLMAligner
using the default
CLMFaceDetector.Configuration
and default size of 100 pixels.public CLMAligner(int size)
CLMAligner
using the default
CLMFaceDetector.Configuration
and given size for the aligned output image.size
- the output facial patch sizepublic CLMAligner(int size, CLMFaceDetector.Configuration config)
CLMAligner
using the provided
CLMFaceDetector.Configuration
and default size of 100 pixels.size
- the output facial patch sizeconfig
- the configurationprotected void loadReference()
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 FImage align(CLMDetectedFace face)
FaceAligner
align
in interface FaceAligner<CLMDetectedFace>
face
- the face to alignpublic FImage getMask()
FaceAligner
getMask
in interface FaceAligner<CLMDetectedFace>