Skip to content

Commit 24a90db

Browse files
authored
fix ptr align (#160)
1 parent 8b319ba commit 24a90db

File tree

5 files changed

+119
-94
lines changed

5 files changed

+119
-94
lines changed

examples/face_landmark/face_landmark.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@
1515

1616
tasks = set()
1717

18-
# You can download a face landmark model file from https://developers.google.com/mediapipe/solutions/vision/face_landmarker#models
19-
model_file = "face_landmarker.task"
20-
model_path = os.path.dirname(os.path.realpath(__file__)) + "/" + model_file
21-
22-
BaseOptions = mp.tasks.BaseOptions
23-
FaceLandmarker = mp.tasks.vision.FaceLandmarker
24-
FaceLandmarkerOptions = mp.tasks.vision.FaceLandmarkerOptions
25-
VisionRunningMode = mp.tasks.vision.RunningMode
26-
27-
options = FaceLandmarkerOptions(
28-
base_options=BaseOptions(model_asset_path=model_path),
29-
running_mode=VisionRunningMode.VIDEO,
30-
)
31-
3218

3319
async def main(room: rtc.Room) -> None:
3420
video_stream = None
@@ -103,7 +89,6 @@ def draw_landmarks_on_image(rgb_image, detection_result):
10389

10490

10591
async def frame_loop(video_stream: rtc.VideoStream) -> None:
106-
landmarker = FaceLandmarker.create_from_options(options)
10792
cv2.namedWindow("livekit_video", cv2.WINDOW_AUTOSIZE)
10893
cv2.startWindowThread()
10994
async for frame_event in video_stream:
@@ -112,19 +97,11 @@ async def frame_loop(video_stream: rtc.VideoStream) -> None:
11297
arr = np.frombuffer(buffer.data, dtype=np.uint8)
11398
arr = arr.reshape((buffer.height, buffer.width, 3))
11499

115-
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=arr)
116-
detection_result = landmarker.detect_for_video(
117-
mp_image, frame_event.timestamp_us
118-
)
119-
120-
draw_landmarks_on_image(arr, detection_result)
121-
122100
arr = cv2.cvtColor(arr, cv2.COLOR_RGB2BGR)
123101
cv2.imshow("livekit_video", arr)
124102
if cv2.waitKey(1) & 0xFF == ord("q"):
125103
break
126104

127-
landmarker.close()
128105
cv2.destroyAllWindows()
129106

130107

livekit-rtc/livekit/rtc/_proto/video_frame_pb2.py

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit-rtc/livekit/rtc/_proto/video_frame_pb2.pyi

Lines changed: 6 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)