deltacv
EOCV-Sim
EOCV-Sim
  • Welcome!
  • Downloading EOCV-Sim
  • Introduction
    • OpenCV and EasyOpenCV
    • EasyOpenCV Pipelines
      • Creating and Running a Pipeline
  • FTC Vision Portal
    • Introduction to VisionPortal
      • Creating and Running a VisionProcessor
      • OpModes in EOCV-Sim
      • Using VisionPortal within OpModes
    • Drawing annotations using Android Canvas
  • Workspaces
    • What are workspaces?
    • VS Code and IntelliJ IDEA
    • Android Studio
  • Features
    • Input Sources
    • Variable Tuner
    • Telemetry
  • Other
    • Building from Source
Powered by GitBook
On this page
  • Lifecycle
  • Adding pipelines to EOCV-Sim
  • Executing a pipeline
Edit on GitHub
  1. Introduction
  2. EasyOpenCV Pipelines

Creating and Running a Pipeline

PreviousEasyOpenCV PipelinesNextIntroduction to VisionPortal

Last updated 5 months ago

Lifecycle

One of the executable units of EOCV-Sim are OpenCvPipelines, which can be created . The lifecycle is automatically managed by the sim, calling:

  • init before the first processFrame

  • processFrame every time a new frame is dispatched from an

  • onViewportTapped when the image displayed on the UI is clicked with the mouse (or tapped if running the pipeline on a phone)

import org.opencv.core.Mat;
import org.openftc.easyopencv.OpenCvPipeline;

public class SamplePipeline extends OpenCvPipeline {

    @Override
    public void init(Mat input) {
        // Executed before the first call to processFrame
    }

    @Override
    public Mat processFrame(Mat input) {
        // Executed every time a new frame is dispatched

        return input; // Return the image that will be displayed in the viewport
                      // (In this case the input mat directly)
    }

    @Override
    public void onViewportTapped() {
        // Executed when the image display is clicked by the mouse or tapped
        // This method is executed from the UI thread, so be careful to not
        // perform any sort heavy processing here! Your app might hang otherwise
    }

}

Adding pipelines to EOCV-Sim

There are two ways for adding your own pipelines:

Executing a pipeline

Once you have added a pipeline using any of the methods mentioned before, executing any given pipeline is very simple. Your pipeline should appear in the "Pipelines" list, the first one located on the right section:

You can learn more about pipelines in .

, which are the fastest and most flexible method of using the sim, since the pipelines are built on-the-fly and changes are applied immediately.

, which allows the use of other JVM languages such as Kotlin, but it is slower since you have to rebuild and wait for the sim to open every time you make changes in your pipelines.

Workspaces are the recommended method for development if you use Java. You can use any IDE or text editor for them. We officially support (partially), .

You can simply select the pipeline by clicking it with your mouse, and will start in your code.

Notice the gears icon the SamplePipeline has, this means that the pipeline was added using the method.

As opposed to the DefaultPipeline which has a hammer and a wrench icon, which means that it was added using the method.

as explained here
Input Source
their respective section
Workspaces
Building from source
Android Studio
VS Code, and IntelliJ IDEA
workspaces
Build from Source
the life cycle explained before
In this case we will use the SamplePipeline shown before