Skip to content
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

fix ptr align #160

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions examples/face_landmark/face_landmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@

tasks = set()

# You can download a face landmark model file from https://developers.google.com/mediapipe/solutions/vision/face_landmarker#models
model_file = "face_landmarker.task"
model_path = os.path.dirname(os.path.realpath(__file__)) + "/" + model_file

BaseOptions = mp.tasks.BaseOptions
FaceLandmarker = mp.tasks.vision.FaceLandmarker
FaceLandmarkerOptions = mp.tasks.vision.FaceLandmarkerOptions
VisionRunningMode = mp.tasks.vision.RunningMode

options = FaceLandmarkerOptions(
base_options=BaseOptions(model_asset_path=model_path),
running_mode=VisionRunningMode.VIDEO,
)


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


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

mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=arr)
detection_result = landmarker.detect_for_video(
mp_image, frame_event.timestamp_us
)

draw_landmarks_on_image(arr, detection_result)

arr = cv2.cvtColor(arr, cv2.COLOR_RGB2BGR)
cv2.imshow("livekit_video", arr)
if cv2.waitKey(1) & 0xFF == ord("q"):
break

landmarker.close()
cv2.destroyAllWindows()


Expand Down
64 changes: 32 additions & 32 deletions livekit-rtc/livekit/rtc/_proto/video_frame_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions livekit-rtc/livekit/rtc/_proto/video_frame_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading