One of the executable units of EOCV-Sim are OpenCvPipelines, which can be created as explained here. The lifecycle is automatically managed by the sim, calling:
init before the first processFrame
processFrame every time a new frame is dispatched from an Input Source
onViewportTapped when the image displayed on the UI is clicked with the mouse (or tapped if running the pipeline on a phone)
importorg.opencv.core.Mat;importorg.openftc.easyopencv.OpenCvPipeline;publicclassSamplePipelineextendsOpenCvPipeline{@Overridepublicvoidinit(Matinput){ // Executed before the first call to processFrame}@OverridepublicMatprocessFrame(Matinput){ // Executed every time a new frame is dispatchedreturn input;// Return the image that will be displayed in the viewport // (In this case the input mat directly)}@OverridepublicvoidonViewportTapped(){ // 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}}
Workspaces, 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.
Building from source, 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 Android Studio (partially), VS Code, and IntelliJ IDEA.
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:
In this case we will use the SamplePipeline shown before