Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issue #222: FaceLandmarks68 left and right eyes/brows are reversed. #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/classes/FaceLandmarks68.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ export class FaceLandmarks68 extends FaceLandmarks {
return this.positions.slice(0, 17)
}

public getLeftEyeBrow(): Point[] {
public getRightEyeBrow(): Point[] {
return this.positions.slice(17, 22)
}

public getRightEyeBrow(): Point[] {
public getLeftEyeBrow(): Point[] {
return this.positions.slice(22, 27)
}

public getNose(): Point[] {
return this.positions.slice(27, 36)
}

public getLeftEye(): Point[] {
public getRightEye(): Point[] {
return this.positions.slice(36, 42)
}

public getRightEye(): Point[] {
public getLeftEye(): Point[] {
return this.positions.slice(42, 48)
}

Expand Down
8 changes: 8 additions & 0 deletions test/tests/faceLandmarkNet/faceLandmark68Net.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ describe('faceLandmark68Net', () => {
const { x, y } = faceLandmarkPositionsRect[i]
expectPointClose(pt, { x, y }, 6)
})
expect(
Math.max(...result.getRightEyeBrow().map(_=>_.x)) <
Math.min(...result.getLeftEyeBrow().map(_=>_.x))
).toBe(true);
expect(
Math.max(...result.getRightEye().map(_=>_.x)) <
Math.min(...result.getLeftEye().map(_=>_.x))
).toBe(true);
})

})
Expand Down