From 42260fba0e94ce02cea3bb9bc01026ef97115517 Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Tue, 24 Sep 2024 15:39:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[feat/#46]=20=EA=B1=B0=EB=B6=81=EB=AA=A9=20?= =?UTF-8?q?threshold=EB=A5=BC=20=EC=9D=B8=EC=9E=90=EB=A1=9C=20=EB=B0=9B?= =?UTF-8?q?=EC=9D=84=20=EC=88=98=20=EC=9E=88=EA=B2=8C=20=EC=88=98=EC=A0=95?= =?UTF-8?q?,=20=ED=84=B1=20=EA=B4=B4=EA=B8=B0=20=EA=B0=90=EB=8F=84=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PoseDetector.tsx | 2 +- src/utils/detector.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/PoseDetector.tsx b/src/components/PoseDetector.tsx index 25e8ab0..168bc45 100644 --- a/src/components/PoseDetector.tsx +++ b/src/components/PoseDetector.tsx @@ -149,7 +149,7 @@ const PoseDetector: React.FC = () => { resultRef.current = results if (snapRef.current) { const _isShoulderTwist = detectSlope(snapRef.current, results, false) - const _isTextNeck = detectTextNeck(snapRef.current, results, true) + const _isTextNeck = detectTextNeck(snapRef.current, results, true, 0.88) const _isHandOnChin = detectHandOnChin(snapRef.current, results) const _isTailboneSit = detectTailboneSit(snapRef.current, results) const _isShowNoti = userNoti?.duration === "IMMEDIATELY" && userNoti?.isActive diff --git a/src/utils/detector.ts b/src/utils/detector.ts index eb918e7..0e355c7 100644 --- a/src/utils/detector.ts +++ b/src/utils/detector.ts @@ -73,7 +73,7 @@ export const getXYfromPose = (poses: pose[], name: string): point | null => { * @param isSnapShotMode 스냅샷 촬영후, 해당 기준으로 자세를 측정할 지 아니면 자동으로 측정할 지 * @returns 거북목 상태라고 판단되면 true, 판단되지 않으면 false, 비교할 수 없는 경우 null을 반환 */ -export const detectTextNeck = (refer: pose[], comp: pose[], isSnapShotMode = true): boolean | null => { +export const detectTextNeck = (refer: pose[], comp: pose[], isSnapShotMode = true, threshold = 1): boolean | null => { if (!comp) return null const referLeftEar = getXYfromPose(refer, "left_ear") @@ -136,7 +136,7 @@ export const detectTextNeck = (refer: pose[], comp: pose[], isSnapShotMode = tru const referShoulderDistance = getDistance(referLeftShoulder, referRightShoulder) const compShoulderDistance = getDistance(compLeftShoulder, compRightShoulder) - const RATIO_DIFF_THRESHOLD = 0.88 + const RATIO_DIFF_THRESHOLD = threshold const referRatio = (0.0001 * referForwardHeadDistance + 1.5 * referShoulderDistance) / From 2de94687f7469ae180b0a729c0f2b5ae3d8c62a6 Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Tue, 24 Sep 2024 20:48:42 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[feat/#46]=20=EA=BC=AC=EB=A6=AC=EB=BC=88?= =?UTF-8?q?=EB=A1=9C=20=EC=95=89=EA=B8=B0=20=EB=A1=9C=EC=A7=81=20=EA=B3=A0?= =?UTF-8?q?=EB=8F=84=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/detector.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/detector.ts b/src/utils/detector.ts index 0e355c7..1de8671 100644 --- a/src/utils/detector.ts +++ b/src/utils/detector.ts @@ -353,7 +353,10 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null = const RATIO_DIFF_THRESHOLD = 0.88 - if (referRatio * RATIO_DIFF_THRESHOLD > compRatio && referShoulderMidPointY < compShoulderMidPointY) { + const referAngle = getAngleBetweenLines(referRightShoulderEarSlope, referLeftShoulderEarSlope) + const compAngle = getAngleBetweenLines(compLeftShoulderEarSlope, compRightShoulderEarSlope) + + if (referRatio * RATIO_DIFF_THRESHOLD > compRatio && referShoulderMidPointY < compShoulderMidPointY && referAngle * 1.2 < compAngle) { return true } else { return false From 19a3731a98e99df8386668c9d277080e7e870a12 Mon Sep 17 00:00:00 2001 From: "lkh14011424@gmail.com" Date: Tue, 24 Sep 2024 20:49:39 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[feat/#46]=20=EA=BC=AC=EB=A6=AC=EB=BC=88=20?= =?UTF-8?q?=EC=95=89=EA=B8=B0=20=ED=83=90=EC=A7=80=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B3=A0=EB=8F=84=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/detector.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/utils/detector.ts b/src/utils/detector.ts index 1de8671..6b8c136 100644 --- a/src/utils/detector.ts +++ b/src/utils/detector.ts @@ -355,8 +355,12 @@ export const detectTailboneSit = (refer: pose[], comp: pose[]): boolean | null = const referAngle = getAngleBetweenLines(referRightShoulderEarSlope, referLeftShoulderEarSlope) const compAngle = getAngleBetweenLines(compLeftShoulderEarSlope, compRightShoulderEarSlope) - - if (referRatio * RATIO_DIFF_THRESHOLD > compRatio && referShoulderMidPointY < compShoulderMidPointY && referAngle * 1.2 < compAngle) { + + if ( + referRatio * RATIO_DIFF_THRESHOLD > compRatio && + referShoulderMidPointY < compShoulderMidPointY && + referAngle * 1.2 < compAngle + ) { return true } else { return false