chromium/third_party/mediapipe/src/mediapipe/calculators/image/image_transformation_calculator.proto

// Copyright 2019 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/calculators/image/rotation_mode.proto";
import "mediapipe/framework/calculator.proto";
import "mediapipe/gpu/scale_mode.proto";

option java_package = "com.google.mediapipe.calculator.proto";
option java_outer_classname = "ImageTransformationCalculatorOptionsProto";

message ImageTransformationCalculatorOptions {
  extend CalculatorOptions {
    optional ImageTransformationCalculatorOptions ext = 251952830;
  }

  // RGB values in range of 0 - 255
  message Color {
    optional int32 red = 1 [default = 0];
    optional int32 green = 2 [default = 0];
    optional int32 blue = 3 [default = 0];
  }

  // Output dimensions. Set to 0 if they should be the same as the input.
  optional int32 output_width = 1 [default = 0];
  optional int32 output_height = 2 [default = 0];
  // Counterclockwise rotation mode.
  optional RotationMode.Mode rotation_mode = 3;
  // Vertical flipping, applied after rotation.
  optional bool flip_vertically = 4 [default = false];
  // Horizontal flipping, applied after rotation.
  optional bool flip_horizontally = 5 [default = false];
  // Scale mode.
  optional ScaleMode.Mode scale_mode = 6;
  // Padding type. This option is only used when the scale mode is FIT. If set
  // to true (default), a constant border is added with color specified by
  // padding_color. If set to false, a border is added by replicating edge
  // pixels (only supported for CPU).
  optional bool constant_padding = 7 [default = true];

  // The color for the padding. This option is only used when the scale mode is
  // FIT. Default is black.
  optional Color padding_color = 8;

  // Interpolation method to use. Note that on CPU when LINEAR is specified,
  // INTER_LINEAR is used for upscaling and INTER_AREA is used for downscaling.
  enum InterpolationMode {
    DEFAULT = 0;
    LINEAR = 1;
    NEAREST = 2;
  }

  // Mode DEFAULT will use LINEAR interpolation.
  optional InterpolationMode interpolation_mode = 9;
}