-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotegrid.h
72 lines (48 loc) · 1.36 KB
/
notegrid.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
68
69
70
71
72
#ifndef NOTEGRID_H
#define NOTEGRID_H
#include <QObject>
#include <string>
#include <vector>
#include <opencv2/opencv.hpp>
#include "synth/audiocontrol.h"
#include "playclock.h"
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
class NoteGrid : public QObject
{
Q_OBJECT
public:
enum Status {
FIXING_PERSPECTIVE,
CLICKS_GOT,
FINDING_GRID,
GRID_FOUND
};
explicit NoteGrid(QObject *parent = 0);
inline Status status() { return mStatus; }
void setAudioControl(AudioControl* ac);
signals:
public slots:
cv::Mat findGrid(cv::Mat* image);
cv::Mat gridFound(cv::Mat* image);
cv::Mat correctPerspective(cv::Mat* image);
void mousePressed(int x, int y);
private:
std::string getLineId(cv::Vec4i line, bool horizontal);
Status mStatus;
std::map<std::string, cv::Vec4i> mHorMap;
std::map<std::string, cv::Vec4i> mVerMap;
std::vector<cv::Vec4i> mHorLines;
std::vector<cv::Vec4i> mVerLines;
cv::SimpleBlobDetector::Params mSimpleBlobParams;
cv::FeatureDetector* mSimpleBlob;
std::vector<cv::Point2f> mPaperCoords;
std::vector<cv::Point2f> mDestCoords;
cv::Mat mTransMtx;
std::vector<std::vector<cv::Point> > mNoteGrid;
cv::Mat mLatestFrame;
PlayClock* mClock;
AudioControl* mAudioControl;
int mActiveNote;
};
#endif // NOTEGRID_H