-
Notifications
You must be signed in to change notification settings - Fork 597
/
mouse.h
40 lines (35 loc) · 1.16 KB
/
mouse.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
#pragma once
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/opencv.hpp>
#include <iostream>
#include <vector>
using namespace std;
using namespace cv;
vector<Point2f> pointsPlate;
vector<Point2f> destinationPlate;
vector<Point2f> pointsSnooker;
vector<Point2f> destinationSnooker;
void platePoints(int event, int x, int y, int flags, void* userdata)
{
if (event == EVENT_LBUTTONDOWN and pointsPlate.size() < 3)
{
cout << "Plate - position (" << x << ", " << y << ")" << endl;
pointsPlate.push_back(Point2f(x, y));
}
else if (event == EVENT_LBUTTONDOWN) {
cout << "Plate - destination (" << x << ", " << y << ")" << endl;
destinationPlate.push_back(Point2f(x, y));
}
}
void snookerPoints(int event, int x, int y, int flags, void* userdata)
{
if (event == EVENT_LBUTTONDOWN and pointsSnooker.size() < 4)
{
cout << "Snooker - position (" << x << ", " << y << ")" << endl;
pointsSnooker.push_back(Point2f(x, y));
}
else if (event == EVENT_LBUTTONDOWN) {
cout << "Snooker - destination (" << x << ", " << y << ")" << endl;
destinationSnooker.push_back(Point2f(x, y));
}
}