Add Keypoint and Region-of-interest

PiperOrigin-RevId: 516299794
This commit is contained in:
Sebastian Schmidt 2023-03-13 13:08:03 -07:00 committed by Copybara-Service
parent 490d1a7516
commit 85600ca326
4 changed files with 49 additions and 0 deletions

View File

@ -15,6 +15,11 @@ mediapipe_ts_declaration(
deps = [":category"],
)
mediapipe_ts_declaration(
name = "keypoint",
srcs = ["keypoint.d.ts"],
)
mediapipe_ts_declaration(
name = "landmark",
srcs = ["landmark.d.ts"],

View File

@ -0,0 +1,33 @@
/**
* 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.
*/
/**
* A keypoint, defined by the coordinates (x, y), normalized by the image
* dimensions.
*/
export declare interface NormalizedKeypoint {
/** X in normalized image coordinates. */
x: number;
/** Y in normalized image coordinates. */
y: number;
/** Optional label of the keypoint. */
label?: string;
/** Optional score of the keypoint. */
score?: number;
}

View File

@ -24,6 +24,9 @@ mediapipe_ts_declaration(
mediapipe_ts_declaration(
name = "types",
srcs = ["types.d.ts"],
deps = [
"//mediapipe/tasks/web/components/containers:keypoint",
],
)
mediapipe_ts_library(

View File

@ -14,6 +14,8 @@
* limitations under the License.
*/
import {NormalizedKeypoint} from '../../../../tasks/web/components/containers/keypoint';
/**
* The segmentation tasks return the segmentation result as a Uint8Array
* (when the default mode of `CATEGORY_MASK` is used) or as a Float32Array (for
@ -32,3 +34,9 @@ export type SegmentationMask = Uint8Array|Float32Array|WebGLTexture;
*/
export type SegmentationMaskCallback =
(masks: SegmentationMask[], width: number, height: number) => void;
/** A Region-Of-Interest (ROI) to represent a region within an image. */
export declare interface RegionOfInterest {
/** The ROI in keypoint format. */
keypoint: NormalizedKeypoint;
}