#pragma once #include #include #include #include #include #include #include #include #include #include using namespace cv; struct LFR_Result { cv::Mat rawImage; cv::Mat processedImage; FrameData data; }; class LFR { public: using ListenerKey = void const*; using ExceptionCallback = std::function; using ListenerCallback = std::function; private: using ListenerPair = std::pair; using ListenerVector = std::vector; Input input; Processing processing; ControlModule controlModule; Interpreter interpreter; IntersectionHandler intersectionHandler; int thresholdBinary; int gaussKernelSize; ListenerVector listeners; ExceptionCallback cb; bool stop; std::unique_ptr thread; mutable std::mutex mutex; //void provideOutput(Mat originalImage, Mat processedImage, const FrameData& frameData, const Rect& roi); void createThread(); void setStop(bool val); public: LFR() = delete; LFR(int videoHeight, int videoWidth, int thresholdBinary, int gaussKernelSize, ExceptionCallback cb); ~LFR(); void startLoop(); void endLoop(); void addListener(ListenerCallback cv, ListenerKey key); void removeListener(ListenerKey key); void isStopped() const noexcept; Mat provideOutput(Mat originalImage, Mat processedImage, const FrameData& frameData, const Rect& roi); };