-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
201 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from "react" | ||
import Camera from "./Camera" | ||
import ControlPanel from "./ControlPanel" | ||
|
||
interface CameraContianerProps { | ||
detectStart: (video: HTMLVideoElement) => void | ||
canvasRef: React.LegacyRef<HTMLCanvasElement> | undefined | ||
isModelLoaded: boolean | ||
onChangeMode: React.ChangeEventHandler<HTMLSelectElement> | ||
onChangeTranslation: React.ChangeEventHandler<HTMLInputElement> | ||
} | ||
|
||
export default function CameraContianer(props: CameraContianerProps) { | ||
const { detectStart, canvasRef, isModelLoaded, onChangeMode, onChangeTranslation } = props | ||
return ( | ||
<div | ||
style={{ | ||
display: "flex", | ||
padding: "20px", | ||
}} | ||
> | ||
<div | ||
style={{ | ||
position: "relative", | ||
}} | ||
> | ||
<Camera onStreamReady={detectStart} /> | ||
<canvas | ||
ref={canvasRef} | ||
width="640" | ||
height="480" | ||
style={{ | ||
position: "absolute", | ||
top: 0, | ||
left: 0, | ||
border: "1px solid black", | ||
}} | ||
/> | ||
</div> | ||
<div | ||
style={{ | ||
paddingLeft: "20px", | ||
width: "150px", | ||
}} | ||
> | ||
{isModelLoaded && <ControlPanel onChangeMode={onChangeMode} onChangeTranslation={onChangeTranslation} />} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from "react" | ||
|
||
interface ControlPanelProps { | ||
onChangeTranslation: React.ChangeEventHandler<HTMLInputElement> | ||
onChangeMode: React.ChangeEventHandler<HTMLSelectElement> | ||
} | ||
|
||
export default function ControlPanel(props: ControlPanelProps) { | ||
const { onChangeTranslation, onChangeMode } = props | ||
return ( | ||
<div> | ||
<div> | ||
<div>좌우 이동</div> | ||
<input id="horizontal" type="range" min={-100} max={100} onChange={onChangeTranslation}></input> | ||
<div>상하 이동</div> | ||
<input id="vertical" type="range" min={-100} max={100} onChange={onChangeTranslation}></input> | ||
<div>크기 변경</div> | ||
<input id="scale" type="range" min={0} max={100} onChange={onChangeTranslation}></input> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
interface TrackingResultProps { | ||
isTextNeck: boolean | null | ||
slope: null | string | ||
} | ||
|
||
export default function TrackingResult(props: TrackingResultProps) { | ||
const { isTextNeck, slope } = props | ||
return ( | ||
<div | ||
style={{ | ||
display: "flex", | ||
flexDirection: "column", | ||
gap: "10px", | ||
}} | ||
> | ||
<div> | ||
거북목 상태: | ||
{isTextNeck === null ? ( | ||
"상태를 확인할 수 없습니다." | ||
) : isTextNeck ? ( | ||
<span className="font-extrabold text-red-500">거북목 상태 입니다</span> | ||
) : ( | ||
"정상적인 자세 입니다" | ||
)} | ||
</div> | ||
<div> | ||
어깨 기울기: {slope === null && <span>상태를 확인할 수 없습니다.</span>} | ||
{slope && <span className={`${!slope.includes("올바른") ? "font-extrabold text-red-500" : ""}`}>{slope}</span>} | ||
</div> | ||
</div> | ||
) | ||
} |