// Copyright 2018 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. syntax = "proto2"; package mediapipe; import "mediapipe/framework/formats/annotation/rasterization.proto"; // A way to identify a part of an image. A locus does not need to correspond to // a subset of pixels -- e.g. for a local descriptor we might define a locus in // terms of its location and scale, even if the support of the descriptor is the // entire image (with location-dependent weighting). message Locus { // Types of image loci on the granularity of the annotation. enum LocusType { // The whole image, without localization. GLOBAL = 1; // The locus refers to a specified bounding box. // Requires bounding_box below. BOUNDING_BOX = 2; // The locus refers to specified regions in the image. // Requires region below. REGION = 3; // This locus refers to groups of loci. Requires component_locus below. VIDEO_TUBE = 4; } optional LocusType locus_type = 1; // A unique identifier for the locus. It is meaningless to compare the // locus_ids in different images. The client should not also assume that // applying the same processing to the same image multiple times will produce // the same locus_id. optional fixed64 locus_id = 2; optional fixed64 locus_id_seed = 6; // "Concatenatable" loci have the property that they appear in the same number // and order for all images, so their corresponding features can be // concatenated. Examples of concatenatable loci include global loci, those // corresponding to fixed bounding boxes, or a single most salient // region. Loci produced by segmentation with a variable number of segments, // on the other hand, are not concatenatable. This flag is true by default. optional bool concatenatable = 5 [default = true]; // Required if locus_type = BOUNDING_BOX, Specifies a bounding box for the // label optional BoundingBox bounding_box = 3; // Specifies a timestamp if this locus appears in a video. // timestamp is specified in mSec from start of the video and refers to the // begining of the locus. optional int32 timestamp = 7 [default = -1]; // Required if locus_type = REGION, Specifies a region using a scanline // encoding optional Rasterization region = 4; // Required if locus_type = VIDEO_TUBE. Specifies the component loci of the // tube. repeated Locus component_locus = 8; } // A representation of a bounding box. message BoundingBox { optional int32 left_x = 1; optional int32 upper_y = 2; optional int32 right_x = 3; optional int32 lower_y = 4; }