Skip to content

Commit

Permalink
Merge pull request #75 from DDD-Community/feat/#46
Browse files Browse the repository at this point in the history
[feat/#46] 꼬리뼈로 앉기 탐지 로직 수정
  • Loading branch information
lkhoony authored Sep 22, 2024
2 parents 58990e5 + 5426996 commit f726fd4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/utils/detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,11 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null =
// 귀의 중점 계산
const compEarMidpoint = getMidPoint(compLeftEar, compRightEar)

// 귀의 중점 계산
const referShoulderMidpoint = getMidPoint(referLeftShoulder, referRightShoulder)
// 귀의 중점 계산
const compShoulderMidpoint = getMidPoint(compLeftShoulder, compRightShoulder)

const referForwardHeadDistance = Math.max(referLeftShoulder.y, referRightShoulder.y) - referEarMidpoint.y
const compForwardHeadDistance = Math.max(compLeftShoulder.y, compRightShoulder.y) - compEarMidpoint.y

Expand Down Expand Up @@ -327,9 +332,12 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null =
const referRatio = 0.7 * referCorrectRatio + 0.3 * referAngleRatio
const compRatio = 0.7 * compCorrectRatio + 0.3 * compAngleRatio

const referShoulderMidPointY = referShoulderMidpoint?.y || 1 // 기본값 설정 (1로 설정하여 0으로 나누기 방지)
const compShoulderMidPointY = compShoulderMidpoint?.y || 1 // 기본값 설정

const RATIO_DIFF_THRESHOLD = 0.88

if (referRatio * RATIO_DIFF_THRESHOLD > compRatio) {
if (referRatio * RATIO_DIFF_THRESHOLD > compRatio && referShoulderMidPointY < compShoulderMidPointY) {
return true
} else {
return false
Expand Down

0 comments on commit f726fd4

Please sign in to comment.