Skip to content

Performing Vision

Tom Tzook edited this page Sep 6, 2019 · 3 revisions

Sensing and operating is a huge part of operating a robot. One such sensing technique is Vision. There are many libraries to perform Vision calculation, and FlashLib has no need to provide another one. However, managing continuous vision operation, and outputting it to robot actions is not so simple. Thus FlashLib a simple framework to manage vision operations.

Vision Process

Vision Process

  • Images are provided by ImageSource implementations. The source may provide the same image, different images, or not provide any image at all.
  • Images then pass through ImagePipelines. These pipelines may perform processing or just write the image to some output.
    • For processing the image, a pipeline may be a VisionPipeline. Such pipeline processes images using ImageProcessors, and analyzes the result using an ImageAnalyzer. After an analysis was created, the analysis is passed to an output consumer.

Implementing

Basic Pipeline

The most basic process can be displaying an image from a source:

ImageSource<ImageType> source = ...
ImagePipeline<ImageType> displayingPipeline = ...

ImageDelegator delegator = new ImageDelegator(source, displayingPipeline);

The ImageDelegator object actually runs the process. This can be done in one of 2 ways. Manually:

while(shouldRun) {
  delegator.delegate();
}

Or with an executor:

Runner runner = new ImageDelegationRunner(delegator, Time.seconds(1), logger);
runner.start();

Processing Pipeline

To actually process an image, we would need to use VisionPipeline.

This pipeline contains multiple ImageProcessors, which perform some processing on the image. This might be color manipulation, resizing and more. All in order to be able to analyze the image.

To analyze images, implement ImageAnalyzer, which extracts an Analysis out of an image. This analysis is done passed to a Consumer, which may handle this analysis.