Inline
This commit is contained in:
parent
75e693186a
commit
eef9bf1f26
1 changed files with 7 additions and 11 deletions
|
@ -15,9 +15,14 @@ export function getFaceCrop(
|
|||
alignment: FaceAlignment,
|
||||
config: FaceCropConfig,
|
||||
): FaceCrop {
|
||||
const box = getAlignedFaceBox(alignment);
|
||||
const alignmentBox = new Box({
|
||||
x: alignment.center.x - alignment.size / 2,
|
||||
y: alignment.center.y - alignment.size / 2,
|
||||
width: alignment.size,
|
||||
height: alignment.size,
|
||||
}).round();
|
||||
const scaleForPadding = 1 + config.padding * 2;
|
||||
const paddedBox = enlargeBox(box, scaleForPadding).round();
|
||||
const paddedBox = enlargeBox(alignmentBox, scaleForPadding).round();
|
||||
const faceImageBitmap = cropWithRotation(imageBitmap, paddedBox, 0, {
|
||||
width: config.maxSize,
|
||||
height: config.maxSize,
|
||||
|
@ -29,15 +34,6 @@ export function getFaceCrop(
|
|||
};
|
||||
}
|
||||
|
||||
function getAlignedFaceBox(alignment: FaceAlignment) {
|
||||
return new Box({
|
||||
x: alignment.center.x - alignment.size / 2,
|
||||
y: alignment.center.y - alignment.size / 2,
|
||||
width: alignment.size,
|
||||
height: alignment.size,
|
||||
}).round();
|
||||
}
|
||||
|
||||
export async function storeFaceCrop(
|
||||
faceId: string,
|
||||
faceCrop: FaceCrop,
|
||||
|
|
Loading…
Add table
Reference in a new issue