Add HAND_CONNECTIONS to HandLandmarker and GestureRecognizer
PiperOrigin-RevId: 524951052
This commit is contained in:
parent
2564fec44c
commit
47e55fcf2f
|
@ -19,7 +19,7 @@ import {Connection} from '../../../../tasks/web/vision/core/types';
|
|||
// tslint:disable:class-as-namespace Using for easier import by 3P users
|
||||
|
||||
/**
|
||||
* A class containing the Pairs of landmark indices to be rendered with
|
||||
* A class containing the pairs of landmark indices to be rendered with
|
||||
* connections.
|
||||
*/
|
||||
export class FaceLandmarksConnections {
|
||||
|
|
|
@ -34,6 +34,7 @@ mediapipe_ts_library(
|
|||
"//mediapipe/tasks/web/core:classifier_options",
|
||||
"//mediapipe/tasks/web/vision/core:image_processing_options",
|
||||
"//mediapipe/tasks/web/vision/core:vision_task_runner",
|
||||
"//mediapipe/tasks/web/vision/hand_landmarker:hand_landmarks_connections",
|
||||
"//mediapipe/web/graph_runner:graph_runner_ts",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -31,6 +31,7 @@ import {convertClassifierOptionsToProto} from '../../../../tasks/web/components/
|
|||
import {WasmFileset} from '../../../../tasks/web/core/wasm_fileset';
|
||||
import {ImageProcessingOptions} from '../../../../tasks/web/vision/core/image_processing_options';
|
||||
import {VisionGraphRunner, VisionTaskRunner} from '../../../../tasks/web/vision/core/vision_task_runner';
|
||||
import {HAND_CONNECTIONS} from '../../../../tasks/web/vision/hand_landmarker/hand_landmarks_connections';
|
||||
import {ImageSource, WasmModule} from '../../../../web/graph_runner/graph_runner';
|
||||
// Placeholder for internal dependency on trusted resource url
|
||||
|
||||
|
@ -72,6 +73,12 @@ export class GestureRecognizer extends VisionTaskRunner {
|
|||
private readonly handGestureRecognizerGraphOptions:
|
||||
HandGestureRecognizerGraphOptions;
|
||||
|
||||
/**
|
||||
* An array containing the pairs of hand landmark indices to be rendered with
|
||||
* connections.
|
||||
*/
|
||||
static HAND_CONNECTIONS = HAND_CONNECTIONS;
|
||||
|
||||
/**
|
||||
* Initializes the Wasm runtime and creates a new gesture recognizer from the
|
||||
* provided options.
|
||||
|
|
|
@ -16,6 +16,7 @@ mediapipe_ts_library(
|
|||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":hand_landmarker_types",
|
||||
":hand_landmarks_connections",
|
||||
"//mediapipe/framework:calculator_jspb_proto",
|
||||
"//mediapipe/framework:calculator_options_jspb_proto",
|
||||
"//mediapipe/framework/formats:classification_jspb_proto",
|
||||
|
@ -72,3 +73,9 @@ jasmine_node_test(
|
|||
tags = ["nomsan"],
|
||||
deps = [":hand_landmarker_test_lib"],
|
||||
)
|
||||
|
||||
mediapipe_ts_library(
|
||||
name = "hand_landmarks_connections",
|
||||
srcs = ["hand_landmarks_connections.ts"],
|
||||
deps = ["//mediapipe/tasks/web/vision/core:types"],
|
||||
)
|
||||
|
|
|
@ -27,6 +27,7 @@ import {Landmark, NormalizedLandmark} from '../../../../tasks/web/components/con
|
|||
import {WasmFileset} from '../../../../tasks/web/core/wasm_fileset';
|
||||
import {ImageProcessingOptions} from '../../../../tasks/web/vision/core/image_processing_options';
|
||||
import {VisionGraphRunner, VisionTaskRunner} from '../../../../tasks/web/vision/core/vision_task_runner';
|
||||
import {HAND_CONNECTIONS} from '../../../../tasks/web/vision/hand_landmarker/hand_landmarks_connections';
|
||||
import {ImageSource, WasmModule} from '../../../../web/graph_runner/graph_runner';
|
||||
// Placeholder for internal dependency on trusted resource url
|
||||
|
||||
|
@ -63,6 +64,12 @@ export class HandLandmarker extends VisionTaskRunner {
|
|||
HandLandmarksDetectorGraphOptions;
|
||||
private readonly handDetectorGraphOptions: HandDetectorGraphOptions;
|
||||
|
||||
/**
|
||||
* An array containing the pairs of hand landmark indices to be rendered with
|
||||
* connections.
|
||||
*/
|
||||
static HAND_CONNECTIONS = HAND_CONNECTIONS;
|
||||
|
||||
/**
|
||||
* Initializes the Wasm runtime and creates a new `HandLandmarker` from the
|
||||
* provided options.
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Copyright 2023 The MediaPipe Authors. All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import {Connection} from '../../../../tasks/web/vision/core/types';
|
||||
|
||||
/**
|
||||
* An array containing the pairs of hand landmark indices to be rendered with
|
||||
* connections.
|
||||
*/
|
||||
export const HAND_CONNECTIONS: Connection[] = [
|
||||
{start: 0, end: 1}, {start: 1, end: 2}, {start: 2, end: 3},
|
||||
{start: 3, end: 4}, {start: 0, end: 5}, {start: 5, end: 6},
|
||||
{start: 6, end: 7}, {start: 7, end: 8}, {start: 5, end: 9},
|
||||
{start: 9, end: 10}, {start: 10, end: 11}, {start: 11, end: 12},
|
||||
{start: 9, end: 13}, {start: 13, end: 14}, {start: 14, end: 15},
|
||||
{start: 15, end: 16}, {start: 13, end: 17}, {start: 0, end: 17},
|
||||
{start: 17, end: 18}, {start: 18, end: 19}, {start: 19, end: 20}
|
||||
];
|
Loading…
Reference in New Issue
Block a user