/*----------------------------------------------------------------------------*/ /* Copyright (c) FIRST 2016-2017. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once namespace frc { /** * Creates a new vision runner. It will take images from the {@code * videoSource}, send them to the {@code pipeline}, and call the {@code * listener} when the pipeline has finished to alert user code when it is safe * to access the pipeline's outputs. * * @param videoSource the video source to use to supply images for the pipeline * @param pipeline the vision pipeline to run * @param listener a function to call after the pipeline has finished * running */ template VisionRunner::VisionRunner(cs::VideoSource videoSource, T* pipeline, std::function listener) : VisionRunnerBase(videoSource), m_pipeline(pipeline), m_listener(listener) {} template void VisionRunner::DoProcess(cv::Mat& image) { m_pipeline->Process(image); m_listener(*m_pipeline); } } // namespace frc