diff --git a/src/Rectangle/Tracking/RectangleTracker.cpp b/src/Rectangle/Tracking/RectangleTracker.cpp new file mode 100755 index 0000000..0ffeb9b --- /dev/null +++ b/src/Rectangle/Tracking/RectangleTracker.cpp @@ -0,0 +1,18 @@ +/* + * RectangleTracker.cpp + * + * Created on: Apr 29, 2018 + * Author: yunya + */ + +#include "RectangleTracker.h" + +RectangleTracker::RectangleTracker() { + // TODO Auto-generated constructor stub + +} + +RectangleTracker::~RectangleTracker() { + // TODO Auto-generated destructor stub +} + diff --git a/src/Rectangle/Tracking/RectangleTracker.h b/src/Rectangle/Tracking/RectangleTracker.h new file mode 100755 index 0000000..d0aa91d --- /dev/null +++ b/src/Rectangle/Tracking/RectangleTracker.h @@ -0,0 +1,22 @@ +/* + * RectangleTracker.h + * + * Created on: Apr 29, 2018 + * Author: yunya + */ + +#ifndef RECTANGLE_RECTANGLETRACKER_H_ +#define RECTANGLE_RECTANGLETRACKER_H_ +#include +#include +#include +#include + +class RectangleTracker { + +public: + RectangleTracker(); + virtual ~RectangleTracker(); +}; + +#endif /* RECTANGLE_RECTANGLETRACKER_H_ */ diff --git a/src/UI.cpp b/src/UI.cpp new file mode 100755 index 0000000..add44be --- /dev/null +++ b/src/UI.cpp @@ -0,0 +1,55 @@ +#include "UI.h" + +UI::UI(int *lastKey) { + this->lastKey = lastKey; +} + +void UI::render() { + if (state < frames.size()) { + frames.resize(state+1); + } + state = 0; + cv::imshow("Normal", frames[0]); + if (debug) { + cv::imshow("debug", frames[debugFrame]); + if (showSlider) { + + } + } + + if (*lastKey == 100) { + debug = !debug; + } + + if (debug) { + if (*lastKey == 110) { + nextDebugFrame(); + } + } +} + +cv::Mat* UI::nextFrame() { + state++; + if (state+1 > frames.size()) { + frames.push_back(cv::Mat{}); + } + return &(frames[state]); +} + +cv::Mat* UI::currentFrame(int offset) { + return &(frames[state + offset]); +} + +void UI::nextDebugFrame() { + debugFrame++; + if (debugFrame > frames.size()-1) { + debugFrame = 0; + } +} + +void UI::setOriginalFrame(cv::Mat frame) { + frames[0] = frame; +} + +UI::~UI() { +} diff --git a/src/UI.h b/src/UI.h new file mode 100755 index 0000000..95471e2 --- /dev/null +++ b/src/UI.h @@ -0,0 +1,31 @@ +/* + * UI.h + * + * Created on: May 5, 2018 + * Author: Yunyang + */ + +#ifndef UI_H_ +#define UI_H_ +#include + +class UI { + bool debug = false, showSlider = false; + unsigned debugFrame = 0; + int *lastKey; + unsigned state = 0; + std::vector frames = {cv::Mat()}; + std::vector debugAddonStarter; +public: + UI(int *lastKey); + void render(); + void nextDebugFrame(); + cv::Mat* nextFrame(); + cv::Mat* currentFrame(int offset); + + void setOriginalFrame(cv::Mat frame); + + virtual ~UI(); +}; + +#endif /* UI_H_ */