From c698381e48ad70b30fb752b71c2e702ef2ceed8f Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Tue, 2 May 2023 18:01:12 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 528939095 --- .../com/google/mediapipe/tasks/vision/BUILD | 1 + .../PoseLandmarksConnections.java | 80 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarksConnections.java diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/BUILD b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/BUILD index 5be0e233..c27da79c 100644 --- a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/BUILD +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/BUILD @@ -180,6 +180,7 @@ android_library( srcs = [ "poselandmarker/PoseLandmarker.java", "poselandmarker/PoseLandmarkerResult.java", + "poselandmarker/PoseLandmarksConnections.java", ], javacopts = [ "-Xep:AndroidJdkLibsChecker:OFF", diff --git a/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarksConnections.java b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarksConnections.java new file mode 100644 index 00000000..9be6a9ae --- /dev/null +++ b/mediapipe/tasks/java/com/google/mediapipe/tasks/vision/poselandmarker/PoseLandmarksConnections.java @@ -0,0 +1,80 @@ +// Copyright 2023 The MediaPipe Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.mediapipe.tasks.vision.poselandmarker; + +import com.google.auto.value.AutoValue; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** Pose landmarks connection constants. */ +public final class PoseLandmarksConnections { + + /** Value class representing pose landmarks connection. */ + @AutoValue + public abstract static class Connection { + static Connection create(int start, int end) { + return new AutoValue_PoseLandmarksConnections_Connection(start, end); + } + + public abstract int start(); + + public abstract int end(); + } + + @SuppressWarnings("ConstantCaseForConstants") + public static final Set POSE_LANDMARKS = + Collections.unmodifiableSet( + new HashSet<>( + Arrays.asList( + Connection.create(0, 1), + Connection.create(1, 2), + Connection.create(2, 3), + Connection.create(3, 7), + Connection.create(0, 4), + Connection.create(4, 5), + Connection.create(5, 6), + Connection.create(6, 8), + Connection.create(9, 10), + Connection.create(11, 12), + Connection.create(11, 13), + Connection.create(13, 15), + Connection.create(15, 17), + Connection.create(15, 19), + Connection.create(15, 21), + Connection.create(17, 19), + Connection.create(12, 14), + Connection.create(14, 16), + Connection.create(16, 18), + Connection.create(16, 20), + Connection.create(16, 22), + Connection.create(18, 20), + Connection.create(11, 23), + Connection.create(12, 24), + Connection.create(23, 24), + Connection.create(23, 25), + Connection.create(24, 26), + Connection.create(25, 27), + Connection.create(26, 28), + Connection.create(27, 29), + Connection.create(28, 30), + Connection.create(29, 31), + Connection.create(30, 32), + Connection.create(27, 31), + Connection.create(28, 32)))); + + private PoseLandmarksConnections() {} +}