public interface

Operation<I, O>

 androidx.camera.core.processing.Operation<I, O>

Subclasses:

JpegBytes2Image, Image2Bitmap, BitmapEffect, JpegImage2Result

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-core', version: '1.5.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-core
  • version: 1.5.0-alpha01

Artifact androidx.camera:camera-core:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

Operation that turns a single input image frame to a output .

Both the input and the output contain one or many camera frames and their metadata such as dimension, format and Exif.

This is a syntax sugar for the Node class. The purpose is for building a pipeline intuitively without using Node's publisher/subscriber model.

Summary

Methods
public java.lang.Objectapply(java.lang.Object i)

Processes an input frame and produces an output frame.

Methods

public java.lang.Object apply(java.lang.Object i)

Processes an input frame and produces an output frame.

The implementation of method performs the image processing operations that usually blocks the current thread. It must be invoked on a non-blocking thread. e.g. CameraXExecutors.ioExecutor().

Source

/*
 * Copyright 2022 The Android Open Source Project
 *
 * 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 androidx.camera.core.processing;

import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread;
import androidx.camera.core.ImageCaptureException;
import androidx.camera.core.impl.utils.executor.CameraXExecutors;

/**
 * Operation that turns a single input image frame {@link I} to a output {@link O}.
 *
 * <p>Both the input {@link I} and the output {@link O} contain one or many camera frames and their
 * metadata such as dimension, format and Exif.
 *
 * <p>This is a syntax sugar for the {@link Node} class. The purpose is for building a pipeline
 * intuitively without using {@link Node}'s publisher/subscriber model.
 *
 * @param <I> input image frame
 * @param <O> output image frame.
 */
public interface Operation<I, O> {

    /**
     * Processes an input frame and produces an output frame.
     *
     * <p>The implementation of method performs the image processing operations that usually
     * blocks the current thread. It must be invoked on a non-blocking thread. e.g.
     * {@link CameraXExecutors#ioExecutor()}.
     */
    @NonNull
    @WorkerThread
    O apply(@NonNull I i) throws ImageCaptureException;
}