Repository navigation
[Refactor] Pose 데이터 계약 및 lifecycle 책임 정리 #86
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f5db938
refactor: Pose 도메인 타입 책임 정리
lioba00700 37fd859
refactor: Pose 검출 lifecycle과 native runtime 분리
lioba00700 7f6d386
docs: Pose 검출 lifecycle 책임 경계 기록
lioba00700 41ad0a3
fix: Pose 검출 runtime 단일 소유권 보장
lioba00700 7b960cc
docs: Pose runtime 단일 owner 제약 기록
lioba00700 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
7 changes: 2 additions & 5 deletions
7
src/features/camera/guide-feed/lib/guide-contour-projection.ts
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,4 +1,2 @@ | ||
| export * from "./native-pose-result-adapter"; | ||
| export * from "./pose-detection-config"; | ||
| export * from "./types"; | ||
| export * from "./use-live-pose-detection"; |
54 changes: 54 additions & 0 deletions
54
src/features/camera/guide-feed/lib/pose-detection/native-pose-detection-runtime.ts
This file contains hidden or 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,54 @@ | ||
| import { | ||
| setVisionCameraPoseErrorCallback, | ||
| setVisionCameraPoseResultCallback, | ||
| visionCameraPoseFrameSink, | ||
| } from "@newpic/vision-camera-pose"; | ||
| import type { PoseDetectionRuntime } from "../../model/pose-detection-types"; | ||
| import { adaptNativeDetectedPoseFrame } from "./native-pose-result-adapter"; | ||
|
|
||
| let activeOwner: symbol | null = null; | ||
|
|
||
| export const nativePoseDetectionRuntime = { | ||
| frameSink: visionCameraPoseFrameSink, | ||
|
|
||
| acquire({ shouldAcceptResult, onFrame, onError }) { | ||
| if (activeOwner) { | ||
| throw new Error("Native pose detection runtime already has an owner."); | ||
| } | ||
|
|
||
| const owner = Symbol("native-pose-detection-owner"); | ||
| activeOwner = owner; | ||
| setVisionCameraPoseResultCallback((nativeFrame) => { | ||
| if (!shouldAcceptResult()) return; | ||
| onFrame(adaptNativeDetectedPoseFrame(nativeFrame)); | ||
| }); | ||
| setVisionCameraPoseErrorCallback((error) => { | ||
| if (!shouldAcceptResult()) return; | ||
| onError(error); | ||
| }); | ||
|
|
||
| return () => { | ||
| if (activeOwner !== owner) return; | ||
|
|
||
| activeOwner = null; | ||
| setVisionCameraPoseResultCallback(undefined); | ||
| setVisionCameraPoseErrorCallback(undefined); | ||
| }; | ||
| }, | ||
|
|
||
| configure(config) { | ||
| visionCameraPoseFrameSink.configure(config); | ||
| }, | ||
|
|
||
| start() { | ||
| visionCameraPoseFrameSink.startAcceptingFrames(); | ||
| }, | ||
|
|
||
| stop() { | ||
| visionCameraPoseFrameSink.stopAcceptingFrames(); | ||
| }, | ||
|
|
||
| release() { | ||
| visionCameraPoseFrameSink.releaseDetector(); | ||
| }, | ||
| } satisfies PoseDetectionRuntime<typeof visionCameraPoseFrameSink>; | ||
2 changes: 1 addition & 1 deletion
2
src/features/camera/guide-feed/lib/pose-detection/native-pose-result-adapter.ts
This file contains hidden or 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 hidden or 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
41 changes: 0 additions & 41 deletions
41
src/features/camera/guide-feed/lib/pose-detection/types.ts
This file was deleted.
Oops, something went wrong.
138 changes: 0 additions & 138 deletions
138
src/features/camera/guide-feed/lib/pose-detection/use-live-pose-detection.ts
This file was deleted.
Oops, something went wrong.
10 changes: 6 additions & 4 deletions
10
src/features/camera/guide-feed/lib/pose-matching/coordinate-transform.ts
This file contains hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
src/features/camera/guide-feed/lib/pose-matching/feed-pose-target-preparer.ts
This file contains hidden or 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
3 changes: 2 additions & 1 deletion
3
src/features/camera/guide-feed/lib/pose-matching/feed-pose-target.ts
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.