@@ -73,7 +73,7 @@ export const getXYfromPose = (poses: pose[], name: string): point | null => {
73
73
* @param isSnapShotMode 스냅샷 촬영후, 해당 기준으로 자세를 측정할 지 아니면 자동으로 측정할 지
74
74
* @returns 거북목 상태라고 판단되면 true, 판단되지 않으면 false, 비교할 수 없는 경우 null을 반환
75
75
*/
76
- export const detectTextNeck = ( refer : pose [ ] , comp : pose [ ] , isSnapShotMode = true ) : boolean | null => {
76
+ export const detectTextNeck = ( refer : pose [ ] , comp : pose [ ] , isSnapShotMode = true , threshold = 1 ) : boolean | null => {
77
77
if ( ! comp ) return null
78
78
79
79
const referLeftEar = getXYfromPose ( refer , "left_ear" )
@@ -136,7 +136,7 @@ export const detectTextNeck = (refer: pose[], comp: pose[], isSnapShotMode = tru
136
136
const referShoulderDistance = getDistance ( referLeftShoulder , referRightShoulder )
137
137
const compShoulderDistance = getDistance ( compLeftShoulder , compRightShoulder )
138
138
139
- const RATIO_DIFF_THRESHOLD = 0.88
139
+ const RATIO_DIFF_THRESHOLD = threshold
140
140
141
141
const referRatio =
142
142
( 0.0001 * referForwardHeadDistance + 1.5 * referShoulderDistance ) /
@@ -353,7 +353,14 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null =
353
353
354
354
const RATIO_DIFF_THRESHOLD = 0.88
355
355
356
- if ( referRatio * RATIO_DIFF_THRESHOLD > compRatio && referShoulderMidPointY < compShoulderMidPointY ) {
356
+ const referAngle = getAngleBetweenLines ( referRightShoulderEarSlope , referLeftShoulderEarSlope )
357
+ const compAngle = getAngleBetweenLines ( compLeftShoulderEarSlope , compRightShoulderEarSlope )
358
+
359
+ if (
360
+ referRatio * RATIO_DIFF_THRESHOLD > compRatio &&
361
+ referShoulderMidPointY < compShoulderMidPointY &&
362
+ referAngle * 1.2 < compAngle
363
+ ) {
357
364
return true
358
365
} else {
359
366
return false
0 commit comments