-
Notifications
You must be signed in to change notification settings - Fork 0
/
camshift.h
67 lines (52 loc) · 1.42 KB
/
camshift.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef CAMSHIFT_H
#define CAMSHIFT_H
#include <annotator/plugins/plugin.h>
#include "widget.h"
#include <QtCore/QObject>
#include <QtCore/QtPlugin>
#include <QtGui/QIcon>
#include <memory>
#include <opencv2/core/mat.hpp>
using std::shared_ptr;
using namespace AnnotatorLib;
namespace AnnotatorLib {
class Session;
}
namespace Annotator {
namespace Plugins {
class CamShift : public Plugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID "annotator.camshift" FILE "camshift.json")
Q_INTERFACES(Annotator::Plugin)
public:
CamShift();
~CamShift();
QString getName() override;
QWidget *getWidget() override;
bool setFrame(shared_ptr<Frame> frame, cv::Mat image) override;
void setObject(shared_ptr<Object> object) override;
shared_ptr<Object> getObject() const override;
void setLastAnnotation(shared_ptr<Annotation> annotation) override;
std::vector<shared_ptr<Commands::Command>> getCommands() override;
protected:
cv::Mat frameImg;
shared_ptr<Annotation> lastAnnotation = nullptr;
shared_ptr<Object> object = nullptr;
bool trackerStarted = false;
bool newSelection = false;
cv::Rect trackWindow, selection;
cv::Mat hsv, hist, hue, mask, backproj;
cv::Rect findObject();
Widget widget;
shared_ptr<Frame> frame = nullptr;
shared_ptr<Frame> lastFrame = nullptr;
int vmin = 10;
int vmax = 256;
int smin = 30;
int hsize = 16;
float hranges[2];
const float *phranges;
};
}
}
#endif // CAMSHIFT_H