Forgot these some important files

This commit is contained in:
Harrison Deng 2018-05-06 14:23:56 -05:00
parent 092ae56e00
commit ccb95d43a5
4 changed files with 126 additions and 0 deletions

View File

@ -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
}

View File

@ -0,0 +1,22 @@
/*
* RectangleTracker.h
*
* Created on: Apr 29, 2018
* Author: yunya
*/
#ifndef RECTANGLE_RECTANGLETRACKER_H_
#define RECTANGLE_RECTANGLETRACKER_H_
#include <opencv2/core/utility.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
class RectangleTracker {
public:
RectangleTracker();
virtual ~RectangleTracker();
};
#endif /* RECTANGLE_RECTANGLETRACKER_H_ */

55
src/UI.cpp Executable file
View File

@ -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() {
}

31
src/UI.h Executable file
View File

@ -0,0 +1,31 @@
/*
* UI.h
*
* Created on: May 5, 2018
* Author: Yunyang
*/
#ifndef UI_H_
#define UI_H_
#include <opencv2/opencv.hpp>
class UI {
bool debug = false, showSlider = false;
unsigned debugFrame = 0;
int *lastKey;
unsigned state = 0;
std::vector<cv::Mat> frames = {cv::Mat()};
std::vector<void(*)()> 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_ */